diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb
index 46ca6341d..d2b74dfa7 100644
--- a/App_Code/ClsAcumuladores.vb
+++ b/App_Code/ClsAcumuladores.vb
@@ -926,7 +926,7 @@ Public Class ClsAcumuladores
Return Retorno
End Function
- Public Function DistribuidorMovtosGet(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha) As Boolean
+ Public Function DistribuidorMovtosGet(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha, Optional CveVentaRNCCargo As Integer = -1) As Boolean
Dim Retorno As Boolean = False
'Data = New DataTable
@@ -937,6 +937,7 @@ Public Class ClsAcumuladores
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@FechaI", SqlDbType.Date).Value = FechaI
.Add("@FechaF", SqlDbType.Date).Value = FechaF
+ .Add("@CveVentaRNCCargo", SqlDbType.Int).Value = CveVentaRNCCargo
End With
Try
diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb
index 911f89a07..4085f9b24 100644
--- a/App_Code/ClsContabilidad.vb
+++ b/App_Code/ClsContabilidad.vb
@@ -253,7 +253,7 @@ Public Class ClsContabilidad
Public Function UpdatePrepolizasDetalle(CvePrePolizaDetalle As Integer, Concepto As String, CveSubProyecto As Integer, IdCtaContable As Integer, TipoMovto As Boolean, ImporteMN As Decimal, Optional CveTipoGasto As Integer = -1,
Optional CveConceptoContable As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCompra As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveCliente As Integer = -1, Optional CveVenta As Integer = -1,
- Optional Referencia As String = "-1") As Boolean
+ Optional Referencia As String = "-1", Optional CveUsuarioModifico As Integer = -1) As Boolean
Dim Retorno As Boolean = False
@@ -274,6 +274,7 @@ Public Class ClsContabilidad
.Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
+ .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico
End With
Try
@@ -1360,7 +1361,7 @@ Public Class ClsContabilidad
End If
If Not OcurrioError Then
- If Not UpdatePrePoliza(Fecha, ObjConta.Folio, CveTipoPoliza, tIdPoliza, CvePrePoliza, Empresa.CveEmpresa) Then
+ If Not UpdatePrePoliza(Fecha, ObjConta.Folio, CveTipoPoliza, tIdPoliza, CvePrePoliza, Empresa.CveEmpresa, CveUsuarioModifico:=CveUsuario) Then
OcurrioError = True
End If
End If
@@ -1506,7 +1507,8 @@ Public Class ClsContabilidad
End Function
- Public Function UpdatePrePoliza(FechaConta As Date, FolioPoliza As Integer, CveTipoPoliza As Integer, IdPoliza As Integer, CvePrePoliza As Integer, CveEmpresa As Integer, Optional Concepto As String = "-1", Optional FechaPoliza As Date = MinFecha, Optional xxx As Integer = -1) As Boolean
+ Public Function UpdatePrePoliza(FechaConta As Date, FolioPoliza As Integer, CveTipoPoliza As Integer, IdPoliza As Integer, CvePrePoliza As Integer, CveEmpresa As Integer,
+ Optional Concepto As String = "-1", Optional FechaPoliza As Date = MinFecha, Optional xxx As Integer = -1, Optional CveUsuarioModifico As Integer = -1) As Boolean
Dim Retorno As Boolean = False
@@ -1521,6 +1523,7 @@ Public Class ClsContabilidad
.Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
.Add("@Concepto", SqlDbType.VarChar).Value = Concepto
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico
End With
Try
diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb
index 69f64de00..2b82c5a1b 100644
--- a/App_Code/ClsGenerales.vb
+++ b/App_Code/ClsGenerales.vb
@@ -2410,7 +2410,7 @@ Public Class ClsGenerales
Public Function GetHistorialBitacora(CveAcarreo As Integer, CveOrdenCompra As Integer, CveActivoFijo As Integer,
CveOS As Integer, CvePS As Integer, CveCompra As Integer, CveIE As Integer,
CveEmpresa As Integer, Optional CveUsuario As Integer = -1, Optional CvePersonal As Integer = -1,
- Optional IdPoliza As Integer = -1) As Boolean
+ Optional IdPoliza As Integer = -1, Optional CvePrePoliza As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Gral_HistorialBitacoraGet")
@@ -2422,6 +2422,7 @@ Public Class ClsGenerales
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@CveCompra", SqlDbType.Int).Value = CveCompra
.Add("@CveIE", SqlDbType.Int).Value = CveIE
+ .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb
index 845ac3d6b..836be534b 100644
--- a/App_Code/ClsMovimientos.vb
+++ b/App_Code/ClsMovimientos.vb
@@ -319,7 +319,7 @@ Public Class ClsMovimientos
End Function
Public Function GetCxCDetalle(FechaI As String, FechaF As String, CveCliente As Integer, CveSubProyecto As Integer, CveVendedor As Integer, CveUsuario As Integer, Anio As Integer, Mes As Integer,
- AnioMes As String, Fecha As String, CveClienteSucursal As Integer, Opcion As String, CveEstatus As Integer, IVA As String, Agrupador As Integer, CveEmpresa As Integer,
+ AnioMes As String, Fecha As String, CveClienteSucursal As Integer, Opcion As String, CveEstatus As Integer, IVA As String, Agrupador As Integer, CveEmpresa As Integer,
CveResponsable As Integer, TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional TipoDocto As String = "-1",
Optional FechaVI As String = "-1", Optional FechaVF As String = "1", Optional FechaCorte As Date = Nothing, Optional CveUsuarioConsulta As Integer = -1,
Optional CveCobranzaEstatus As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional LimiteCredito As Decimal = -1,
@@ -361,10 +361,10 @@ Public Class ClsMovimientos
.Add("@CveCobranzaEstatus", SqlDbType.Int).Value = CveCobranzaEstatus
.Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion
.Add("@LimiteCredito", SqlDbType.Float).Value = LimiteCredito
- .Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente
- .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
- .Add("@EstatusCliente", SqlDbType.Int).Value = EstatusCliente
-
+ .Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente
+ .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
+ .Add("@EstatusCliente", SqlDbType.Int).Value = EstatusCliente
+
End With
Try
@@ -545,7 +545,7 @@ Public Class ClsMovimientos
- Try
+ Try
SqlAdapter.SelectCommand.CommandTimeout = 0
SqlAdapter.Fill(Data)
@@ -863,8 +863,8 @@ Public Class ClsMovimientos
DataAdapter("PA_Banc_ReporteChequesFYEGet")
With SqlAdapter.SelectCommand.Parameters
- .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
- .Add("@FechaI", SqlDbType.DateTime).Value = FechaI
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ .Add("@FechaI", SqlDbType.DateTime).Value = FechaI
.Add("@FechaF", SqlDbType.DateTime).Value = FechaF
End With
@@ -1190,9 +1190,9 @@ Public Class ClsMovimientos
Public Function GetCxPDetalle(FechaI As String, FechaF As String, CveProveedor As Integer, CveProveedorClasificacion As Integer, CveProveedorSucursal As Integer, CveUsuario As Integer,
CveUsuarioResponsable As Integer, Anio As Integer, Mes As Integer, AnioMes As String, CveMoneda As Integer, CveSubProyecto As Integer,
- CveEstatusFactura As Integer, Fecha As String, Agrupador As Integer, Opcion As String, CveEmpresa As Integer, CveSucursal As Integer,
- TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional FechaVI As String = "-1", Optional FechaVF As String = "1",
- Optional FechaCorte As Date = Nothing, Optional CveUsuarioConsulta As Integer = -1, Optional CveTipoProveedor As Integer = -1,
+ CveEstatusFactura As Integer, Fecha As String, Agrupador As Integer, Opcion As String, CveEmpresa As Integer, CveSucursal As Integer,
+ TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional FechaVI As String = "-1", Optional FechaVF As String = "1",
+ Optional FechaCorte As Date = Nothing, Optional CveUsuarioConsulta As Integer = -1, Optional CveTipoProveedor As Integer = -1,
Optional Comprobaciones As Integer = -1, Optional AplicaNC As Integer = -1) As Boolean
Dim Retorno As Boolean = False
@@ -1292,8 +1292,8 @@ Public Class ClsMovimientos
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
.Add("@CveCajaChica", SqlDbType.Int).Value = CveCajaChica
- .Add("@NumeroReembolso", SqlDbType.VarChar).Value = NumeroReembolso
- .Add("@FechaI", SqlDbType.DateTime).Value = FechaI
+ .Add("@NumeroReembolso", SqlDbType.VarChar).Value = NumeroReembolso
+ .Add("@FechaI", SqlDbType.DateTime).Value = FechaI
.Add("@FechaF", SqlDbType.DateTime).Value = FechaF
End With
diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb
index 45ff1f778..da59d111c 100644
--- a/App_Code/Modelos.vb
+++ b/App_Code/Modelos.vb
@@ -5612,6 +5612,7 @@ Namespace Modelos
Public Property RefacturacionGeneroNC As Boolean = False
Public Property Pagado As Decimal
Public Property DescuentoProntoPago As Decimal
+ Public Property CveVentaRNCCargo As Integer
'Public Property Sucursal As SucursalModel
Public Property SubProyecto As Modelos.SubProyectoModel
diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx
index 865c667d4..fe81513fa 100644
--- a/Ashx/SIGWeb.ashx
+++ b/Ashx/SIGWeb.ashx
@@ -43,6 +43,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
ActualizaPrePoliza(context)
Case "getpersonal"
getpersonal(context)
+ Case "getcontratos"
+ GetContratos(context)
Case "GettingCURP"
context.Response.Write(GettingCURP(context.Request("Curp").ToString(), context.Request("year").ToString().ToEntero()))
Case "ValidaCURP"
@@ -1116,4 +1118,38 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
Return retorno
End Function
#End Region
+
+#Region "Get Contratos"
+ Private Function GetContratos(ByVal context As HttpContext) As String
+ Dim retorno As String = ""
+ Dim DtRetorno As DataTable = Nothing
+
+ Dim usuario As Usuario = UsuarioActual(context)
+ Dim CveEmpresa As String
+ If IsNothing(usuario) Then
+ context.Response.Write("")
+ Else
+ CveEmpresa = usuario.CveEmpresa
+ Dim Name = IfNull(context.Request("Name"), "-1").ToString
+
+ Dim dt As DataTable = DirectCast(context.Application("GlobalDTContratos"), DataTable).FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa))
+ If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
+ DtRetorno = dt.FiltraParametros(String.Format("NumeroContrato like '%{0}%'", Name))
+ End If
+ dt.Dispose()
+ End If
+
+ If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
+ DtRetorno.Columns("CveContrato").ColumnName = "id"
+ DtRetorno.Columns("NumeroContrato").ColumnName = "text"
+ retorno = JsonConvert.SerializeObject(DtRetorno).ToString
+ context.Response.Write(retorno)
+ Else
+ context.Response.Write("[]")
+ End If
+
+ DtRetorno.Dispose()
+ Return retorno
+ End Function
+#End Region
End Class
\ No newline at end of file
diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx
index 4afd58c6e..2edbabca2 100644
--- a/Compras/Compras.aspx
+++ b/Compras/Compras.aspx
@@ -37,9 +37,6 @@
Los cambios se realizaran al dar click en vincular
@@ -5112,8 +5100,14 @@
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 3c40bd9b8..14d802679 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -1533,7 +1533,7 @@ Partial Class Compras_Compras
If UsuarioActual.Empresa.CvePlataforma = 2 Then
TabActivosFijos.Visible = False
VerRefacturacion.Visible = False
- liServicios.Visible = False
+ 'liServicios.Visible = False
DivConsignaciones.Visible = False
End If
CargarCentrosDeCosto(DdlAsignarProyecto, DdlAsignaSubProyecto, LitHProyecto, LblSubProyectoHeader)
@@ -9545,7 +9545,7 @@ Partial Class Compras_Compras
Retorno = False
End If
- If Not ObjContabilidad.UpdatePrePoliza(MinFecha, -1, -1, Nothing, CvePrePoliza, UsuarioActual.CveEmpresa) Then
+ If Not ObjContabilidad.UpdatePrePoliza(MinFecha, -1, -1, Nothing, CvePrePoliza, UsuarioActual.CveEmpresa, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
Retorno = False
End If
End If
@@ -9987,7 +9987,7 @@ Partial Class Compras_Compras
Retorno = False
End If
- If Not ObjContabilidad.UpdatePrePoliza(MinFecha, -1, -1, IdPoliza, CvePrePoliza, UsuarioActual.CveEmpresa) Then
+ If Not ObjContabilidad.UpdatePrePoliza(MinFecha, -1, -1, IdPoliza, CvePrePoliza, UsuarioActual.CveEmpresa, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
Retorno = False
End If
End If
@@ -14642,7 +14642,7 @@ Partial Class Compras_Compras
dt = ObjContabilidad.DtResultados
For Each dr As DataRow In dt.Rows
- If Not ObjContabilidad.UpdatePrepolizasDetalle(dr("CvePrePolizaDetalle").ToString.ToEntero, dr("Concepto").ToString, dr("CveSubProyecto").ToString.ToEntero, dr("IdCtaContable").ToString.ToEntero, CBool(dr("TipoMovto").ToString), 0) Then
+ If Not ObjContabilidad.UpdatePrepolizasDetalle(dr("CvePrePolizaDetalle").ToString.ToEntero, dr("Concepto").ToString, dr("CveSubProyecto").ToString.ToEntero, dr("IdCtaContable").ToString.ToEntero, CBool(dr("TipoMovto").ToString), 0, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
ErrorCancelar = True : Exit For
End If
Next
@@ -15892,71 +15892,71 @@ Partial Class Compras_Compras
End Sub
Protected Sub BtnFiltrar_Click(sender As Object, e As EventArgs)
- If DdlTipo.SelectedValue.ToEntero = 1 Then
+ 'POR SI LLEGARA A TRONAR
+ If DtServicios Is Nothing Then CreaDTServicios()
+ DtServicios.Rows.Clear()
- 'POR SI LLEGARA A TRONAR
- If DtServicios Is Nothing Then CreaDTServicios()
- DtServicios.Rows.Clear()
+ Dim objps As New ClsProductosServicios
+ Dim dr As DataRow
+ dvFacturas.Visible = False
+ GvFacturas.Visible = False
- Dim objps As New ClsProductosServicios
- Dim dr As DataRow
- dvFacturas.Visible = False
- GvFacturas.Visible = False
-
- For Each DrGv As DataRow In TmpDT.Rows
- If DrGv("CvePS").ToString.ToEntero > 0 Then
- If objps.GetPS(DrGv("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Then
- If objps.DtResultados(0)("CveTipoPS").ToString.ToEntero = 1 Then
- dr = DtServicios.NewRow()
- dr("Consec") = DrGv("Consec").ToString.ToEntero
- dr("Total") = DrGv("Total").ToString.ToDecimal
- dr("CvePS") = DrGv("CvePS").ToString.ToEntero
- dr("PS") = DrGv("PS").ToString
- DtServicios.Rows.Add(dr)
- End If
+ For Each DrGv As DataRow In TmpDT.Rows
+ If DrGv("CvePS").ToString.ToEntero > 0 Then
+ If objps.GetPS(DrGv("CvePS").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Then
+ If objps.DtResultados(0)("CveTipoPS").ToString.ToEntero = 1 Then
+ dr = DtServicios.NewRow()
+ dr("Consec") = DrGv("Consec").ToString.ToEntero
+ dr("Total") = DrGv("Total").ToString.ToDecimal
+ dr("CvePS") = DrGv("CvePS").ToString.ToEntero
+ dr("PS") = DrGv("PS").ToString
+ DtServicios.Rows.Add(dr)
End If
End If
- Next
-
- '[IPP] COMENTADO - MIRAS DE ELIMINAR - 8/FEBRERO/2018
- 'For Each gvr As GridViewRow In GvPS.Rows
- ' If objps.GetPS(gvr.DataKey("CvePS").ToEntero, -1, UsuarioActual.CveEmpresa) Then
- ' If objps.DtResultados(0)("CveTipoPS").ToString.ToEntero = 1 Then
- ' dr = DtServicios.NewRow()
- ' dr("Consec") = gvr.FCLabel("LtlConsecutivo").Text.ToEntero
- ' dr("Total") = gvr.FCLiteral("LtlTotal").Text.ToDecimal
- ' dr("PS") = gvr.DataKey("PS").ToString
- ' DtServicios.Rows.Add(dr)
- ' End If
- ' End If
- 'Next
- objps.Dispose()
-
- If DtServicios.Rows.Count > 0 Then
- GVServicios.DataSource = DtServicios
- GVServicios.DataBind()
- GVServicios.Visible = True
- Else
- GVServicios.DataSource = Nothing
- GVServicios.DataBind()
End If
+ Next
- UpGVServicios.Update()
- UpFacturas.Update()
- UPGVFacturas.Update()
-
- ElseIf DdlTipo.SelectedValue.ToEntero = 2 Then
- GVServicios.Visible = False
- dvFacturas.Visible = True
- DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
- DdlProveedores.DataBind()
- DdlProveedores.Items.Insert(0, New ListItem("Seleccione", "-1"))
- UpFacturas.Update()
- UpGVServicios.Update()
-
+ '[IPP] COMENTADO - MIRAS DE ELIMINAR - 8/FEBRERO/2018
+ 'For Each gvr As GridViewRow In GvPS.Rows
+ ' If objps.GetPS(gvr.DataKey("CvePS").ToEntero, -1, UsuarioActual.CveEmpresa) Then
+ ' If objps.DtResultados(0)("CveTipoPS").ToString.ToEntero = 1 Then
+ ' dr = DtServicios.NewRow()
+ ' dr("Consec") = gvr.FCLabel("LtlConsecutivo").Text.ToEntero
+ ' dr("Total") = gvr.FCLiteral("LtlTotal").Text.ToDecimal
+ ' dr("PS") = gvr.DataKey("PS").ToString
+ ' DtServicios.Rows.Add(dr)
+ ' End If
+ ' End If
+ 'Next
+ objps.Dispose()
+ If DtServicios.Rows.Count > 0 Then
+ GVServicios.DataSource = DtServicios
+ GVServicios.DataBind()
+ GVServicios.Visible = True
+ Else
+ GVServicios.DataSource = Nothing
+ GVServicios.DataBind()
End If
+ UpGVServicios.Update()
+ UpFacturas.Update()
+ UPGVFacturas.Update()
+ 'If DdlTipo.SelectedValue.ToEntero = 1 Then
+
+
+ 'ElseIf DdlTipo.SelectedValue.ToEntero = 2 Then
+ ' GVServicios.Visible = False
+ ' dvFacturas.Visible = True
+ ' DdlProveedores.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
+ ' DdlProveedores.DataBind()
+ ' DdlProveedores.Items.Insert(0, New ListItem("Seleccione", "-1"))
+ ' UpFacturas.Update()
+ ' UpGVServicios.Update()
+
+
+ 'End If
+
End Sub
Public Sub btnAgregarFlete_Click(sender As Object, e As EventArgs) Handles BtnAgregarFlete.Click
@@ -16212,7 +16212,7 @@ Partial Class Compras_Compras
End If
If UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.CvePlataforma <> 2 Then
- liServicios.Visible = True
+ 'liServicios.Visible = True
liFletesImportaciones.Visible = True
End If
@@ -20040,6 +20040,17 @@ Partial Class Compras_Compras
End If
End Sub
+ Protected Sub RblGastosVincularCrear_Click(sender As Object, e As EventArgs)
+ Dim MostrarGastosServicios As Boolean = RblGastosVincularCrear.SelectedValue = "1"
+
+ DivGastosyServicios.Visible = MostrarGastosServicios
+ DivGastosyServiciosFooter.Visible = MostrarGastosServicios
+
+ DivVincularCrear.Visible = Not MostrarGastosServicios
+ DivVincularCrearFooter.Visible = Not MostrarGastosServicios
+
+ End Sub
+
End Class
diff --git a/Contabilidad/RegPoliza.aspx.vb b/Contabilidad/RegPoliza.aspx.vb
index 4aa040ece..42de3dde7 100644
--- a/Contabilidad/RegPoliza.aspx.vb
+++ b/Contabilidad/RegPoliza.aspx.vb
@@ -1143,7 +1143,7 @@ Partial Class RegPoliza
End If
End If
- If Not ObjContabilidad.UpdatePrePoliza(TxtFechaPoliza.Text.ToDate, TxtNumeroPoliza.Text.ToEntero, DdlTipoPoliza.SelectedValue.ToEntero, IDPoliza, CvePrePoliza, UsuarioActual.CveEmpresa, TxtConcepto.Text.Trim, TxtFechaPoliza.Text.ToDate) Then
+ If Not ObjContabilidad.UpdatePrePoliza(TxtFechaPoliza.Text.ToDate, TxtNumeroPoliza.Text.ToEntero, DdlTipoPoliza.SelectedValue.ToEntero, IDPoliza, CvePrePoliza, UsuarioActual.CveEmpresa, TxtConcepto.Text.Trim, TxtFechaPoliza.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
OcurrioError = True
End If
diff --git a/Contabilidad/RegPrePoliza.aspx b/Contabilidad/RegPrePoliza.aspx
index 691ac28d4..734a5ec1a 100644
--- a/Contabilidad/RegPrePoliza.aspx
+++ b/Contabilidad/RegPrePoliza.aspx
@@ -497,6 +497,42 @@
+
+
+
+
+
+
+
+
+ Historial de Modificación
+
+
+
+
+
+
+
+
+
+
+ Fecha
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb
index 8286d7e17..914c95ef6 100644
--- a/Contabilidad/RegPrePoliza.aspx.vb
+++ b/Contabilidad/RegPrePoliza.aspx.vb
@@ -209,6 +209,7 @@ Partial Class ContabilidadC_RegPrePoliza
ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero
CreaDT()
CargaPrePoliza()
+ CargaGvBitacora()
If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then
GvPrePoliza.Columns(4).Visible = False
GvConcepto.Columns(4).Visible = False
@@ -463,9 +464,10 @@ Partial Class ContabilidadC_RegPrePoliza
End If
End If
-
+ CargaGvBitacora()
ObjContabilidad.Dispose()
UpPoliza.Update()
+ UpBitacora.Update()
End Sub
Private Sub GvPrePoliza_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPrePoliza.RowDataBound
@@ -536,7 +538,7 @@ Partial Class ContabilidadC_RegPrePoliza
End Sub
Private Sub DdlConceptosContables_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContables.SelectedIndexChanged
- If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 201, 206, 14, 15, 16, 19, 25, 26, 21) Then
+ If DdlConceptosContables.SelectedValue.ToEntero.Contiene(5, 17, 201, 205, 206, 14, 15, 16, 19, 25, 26, 21) Then
CargaProveedores()
DdlProveedores.Visible = True
DdlCompras.Visible = True
@@ -1011,7 +1013,7 @@ Partial Class ContabilidadC_RegPrePoliza
- If ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate) Then
+ If ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
@@ -1019,7 +1021,7 @@ Partial Class ContabilidadC_RegPrePoliza
If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then
If Not ObjContabilidad.UpdatePrepolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCTextBox("TxtConcepto").Text, row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero,
row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero, If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0,
- row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, row.DataKey("CveTipoGasto").ToEntero)) Then
+ row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, row.DataKey("CveTipoGasto").ToEntero), CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
End If
@@ -1643,5 +1645,15 @@ Partial Class ContabilidadC_RegPrePoliza
End If
ObjCompras.Dispose()
End Sub
+
+ Private Sub CargaGvBitacora()
+ ' COMENTADO POR IPP PARA SUBIR 5 ABRIL 2017
+ Dim ObjGral As New ClsGenerales()
+ If ObjGral.GetHistorialBitacora(-1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa, CvePrePoliza:=CvePrePoliza) Then
+ GvBitacora.DataSource = ObjGral.DtResultados
+ GvBitacora.DataBind()
+ End If
+ ObjGral.Dispose()
+ End Sub
End Class
diff --git a/Contabilidad/RegPrePoliza1.aspx.vb b/Contabilidad/RegPrePoliza1.aspx.vb
index cee888e0f..bfa0a695d 100644
--- a/Contabilidad/RegPrePoliza1.aspx.vb
+++ b/Contabilidad/RegPrePoliza1.aspx.vb
@@ -926,7 +926,7 @@ Partial Class ContabilidadC_RegPrePoliza
Dim ObjContabilidad As New ClsContabilidad
ObjContabilidad.IniciaTransacSQL()
- ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate)
+ ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario)
For Each row As GridViewRow In GvPrePoliza.Rows
If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then
@@ -934,7 +934,7 @@ Partial Class ContabilidadC_RegPrePoliza
row.DataKey("IdCtaContable").ToEntero, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero),
CveConceptoContable:=row.DataKey("CveConceptoContable").ToEntero, CveProveedor:=row.DataKey("CveProveedor").ToEntero, CveCompra:=row.DataKey("CveCompra").ToEntero,
- CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text) Then
+ CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
End If
diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb
index 55009d5a3..074017309 100644
--- a/Contabilidad/RegPrePolizaS.aspx.vb
+++ b/Contabilidad/RegPrePolizaS.aspx.vb
@@ -914,7 +914,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Dim ObjContabilidad As New ClsContabilidad
ObjContabilidad.IniciaTransacSQL()
- ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate)
+ ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario)
For Each row As GridViewRow In GvPrePoliza.Rows
If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then
@@ -922,7 +922,7 @@ Partial Class ContabilidadC_RegPrePolizaS
row.DataKey("IdCtaContable").ToEntero, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero),
CveConceptoContable:=row.DataKey("CveConceptoContable").ToEntero, CveProveedor:=row.DataKey("CveProveedor").ToEntero, CveCompra:=row.DataKey("CveCompra").ToEntero,
- CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text) Then
+ CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
End If
diff --git a/Contratos/Contrato.aspx b/Contratos/Contrato.aspx
index 0bb5d7b3a..4b9616588 100644
--- a/Contratos/Contrato.aspx
+++ b/Contratos/Contrato.aspx
@@ -1,2476 +1,2495 @@
-<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Contrato.aspx.vb" Inherits="Contratos_Default" %>
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
+
diff --git a/Contratos/Contrato.aspx.vb b/Contratos/Contrato.aspx.vb
index 59f211c7d..75be99a9c 100644
--- a/Contratos/Contrato.aspx.vb
+++ b/Contratos/Contrato.aspx.vb
@@ -1199,13 +1199,16 @@ Partial Class Contratos_Default
GvFianzas.DataBind()
UpGvFianzas.Update()
- End Sub
+ End Sub
#End Region
-
+
#Region " GUARDAR "
- Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
- Dim ObjContratos As New ClsContratos
- Dim ObjInventarios As New ClsInventarios(ObjContratos.IniciaTransacSQL)
+ Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
+
+ If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then
+ Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
Dim TieneError = False
Dim Modificado = False
@@ -1221,21 +1224,30 @@ Partial Class Contratos_Default
Maximo = txtMaximo.Text.ToDouble
Total = TxtTotal.Text.ToDouble
+ If DdlTipoContrato.SelectedValue = "25" AndAlso DdlPeriodo.SelectedValue.ToEntero() <= 0 Then
+ Alert("Debe seleccionar el periodo de facturación.", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
If DdlMoneda.SelectedIndex > 0 Then
If TxtTipoCambio.Text.Trim.Length = 0 Or TxtTipoCambio.Text.Trim.ToDouble = 0.0 Then
Alert("Cuando seleccione una moneda diferente a peso debe especificar el tipo de cambio.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
- End If
-
-
- 'Crear Contrato
- If Not CveContrato > 0 Then
+ End If
+
+ If CveContrato > 0 Then
If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then
Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
- End If
+ End If
+ End If
+
+ Dim ObjContratos As New ClsContratos
+ Dim ObjInventarios As New ClsInventarios(ObjContratos.IniciaTransacSQL)
+
+ 'Crear Contrato
+ If Not CveContrato > 0 Then
CveContrato = ObjContratos.AddContratos(TxtNumeroContrato.Text, TxtDescripcionContrato.Text, TxtNumeroLicitacion.Text.Trim, DdlContratista.SelectedValue.ToEntero, DdlCliente.SelectedValue.ToEntero, -1, TxtFechaInicial.Text.ToDate, TxtFechaFinal.Text.ToDate,
TxtUbicacion.Text, TxtResponsable.Text, DdlSubProyectoContrato.SelectedValue.ToEntero, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble,
@@ -1323,18 +1335,9 @@ Partial Class Contratos_Default
TieneError = True
End If
-
-
-
-
-
-
Else
Modificado = True
- If DdlContratista.SelectedValue.ToEntero = -1 And DdlCliente.SelectedValue.ToEntero = -1 Then
- Alert("Debe seleccionar con quién está haciendo el contrato. Proveedor o Cliente", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
+
Dim ArchivoUpdate As String = "-1"
If Session("FileExtension").ToString <> "" Then
@@ -1433,16 +1436,8 @@ Partial Class Contratos_Default
End If
-
-
-
-
End If
- 'If Not TieneError Then
- ' TieneError = GuardarAlmacen(ObjInventarios)
- 'End If
-
If TieneError Then
ObjContratos.RollBack()
Else
@@ -1461,12 +1456,11 @@ Partial Class Contratos_Default
End If
-
UpGral.Update()
ObjContratos.Dispose()
- End Sub
+ End Sub
#End Region
-
+
#Region " ELIMINAR "
Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Handles BtnEliminar.Click
Dim objContratos As New ClsContratos
diff --git a/Contratos/FacturacionMasiva.aspx b/Contratos/FacturacionMasiva.aspx
index ad378c4fb..431aa81db 100644
--- a/Contratos/FacturacionMasiva.aspx
+++ b/Contratos/FacturacionMasiva.aspx
@@ -34,14 +34,11 @@
Cliente:
-
-
-
+
Contrato:
-
-
-
+
+
Sucursal:
diff --git a/Contratos/FacturacionMasiva.aspx.vb b/Contratos/FacturacionMasiva.aspx.vb
index d43c26fc3..d4d6f5fd4 100644
--- a/Contratos/FacturacionMasiva.aspx.vb
+++ b/Contratos/FacturacionMasiva.aspx.vb
@@ -111,8 +111,9 @@ Partial Class Contratos_FacturacionMasiva
If Not IsPostBack Then
FolioVigentes = False
CargaCombos()
- txtFechaI.Text = DateTime.Today.ToString("d")
- txtFechaF.Text = DateTime.Today.ToString("d")
+ Dim FechaRef = DateTime.Now
+ txtFechaI.Text = $"01/{FechaRef.Month}/{FechaRef.Year}"
+ txtFechaF.Text = txtFechaI.Text.ToDate().AddMonths(1).ToString("dd/MM/yyyy")
CargaDatos(-1, -1)
CreaDTVentas()
Mensaje = ""
@@ -131,11 +132,44 @@ Partial Class Contratos_FacturacionMasiva
ValidaFolio()
Dim ObjContratos As New ClsContratos
- If ObjContratos.CicloComercialGet(CveContrato, CveCliente, -1, UsuarioActual.CveEmpresa, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, DdlSucursal.SelectedValue.ToEntero) Then
- DTCicloComercial = ObjContratos.DtResultados().FiltraParametros($"FueFacturado = 0")
- GvCiclosComerciales.DataSource = DTCicloComercial
- End If
- ObjContratos.Dispose()
+ Try
+ If ObjContratos.CicloComercialGet(CveContrato, CveCliente, -1, UsuarioActual.CveEmpresa, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, DdlSucursal.SelectedValue.ToEntero) Then
+ DTCicloComercial = ObjContratos.DtResultados.Clone
+
+ For Each Row As DataRow In ObjContratos.DtResultados().FiltraParametros($"FueFacturado = 0").Rows
+
+ If Row("Observaciones").ToString().Contains("{DIA}") Then
+ Row("Observaciones") = Row("Observaciones").ToString().Replace("{DIA}", DateTime.Now.Day.ToString())
+ End If
+
+ If Row("Observaciones").ToString().Contains("{MES}") Then
+ Dim fecha As DateTime = DateTime.Now
+ Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
+ Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
+
+ Row("Observaciones") = Row("Observaciones").ToString().Replace("{MES}", nombreMes)
+ End If
+
+ If Row("Observaciones").ToString().Contains("{AÑO}") Then
+ Row("Observaciones") = Row("Observaciones").ToString().Replace("{AÑO}", DateTime.Now.Year.ToString())
+ End If
+
+ If Row("Observaciones").ToString().Contains("{TC}") Then
+ Row("Observaciones") = Row("Observaciones").ToString().Replace("{TC}", GlobalTipoCambio(Now).FormatoNumero)
+ End If
+
+ DTCicloComercial.Rows.Add(Row.ItemArray)
+ Next
+
+
+ End If
+ Catch ex As Exception
+ DTCicloComercial = Nothing
+ OnError("Ocurrió un error al obtener las facturas a realizar", ex)
+ End Try
+ ObjContratos.Dispose()
+
+ GvCiclosComerciales.DataSource = DTCicloComercial
GvCiclosComerciales.DataBind()
UpGv.Update()
End Sub
@@ -174,14 +208,9 @@ Partial Class Contratos_FacturacionMasiva
Dim sb As New StringBuilder()
For Each row As GridViewRow In GvCiclosComerciales.Rows
- If row.FCCheckBox("chkDis").Checked Then
- Dim fecha As DateTime = DateTime.Now ', row.DataKey("FechaVenc").ToString.ToDateTime()
- Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat
- Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper()
+ If row.FCCheckBox("chkDis").Checked Then
- Dim Etiqueta As String = String.Format("{0} - {1}", nombreMes, fecha.Year)
-
- Dim Resp = EmitirImprimir(row.DataKey("CveCicloComercial").ToString.ToEntero, Etiqueta)
+ Dim Resp = EmitirImprimir(row.DataKey("CveCicloComercial").ToString.ToEntero)
For Each Msg In Resp.Mensajes
sb.AppendFormat("{0}", Msg)
@@ -212,10 +241,10 @@ Partial Class Contratos_FacturacionMasiva
EjecutarFacturacion()
End Sub
- Private Function EmitirImprimir(pCveCicloComercial As Integer, Etiqueta As String) As Modelos.Factura.MMensajeFactura
+ Private Function EmitirImprimir(pCveCicloComercial As Integer) As Modelos.Factura.MMensajeFactura
Dim Resp As New Modelos.Factura.MMensajeFactura
ViewState("CveCicloComercial") = pCveCicloComercial
- CreaObjetosVenta(Etiqueta)
+ CreaObjetosVenta()
If ObjFactura Is Nothing Or ObjFactura.Cliente Is Nothing Then
Alert("Ocurrió un error al procesar los datos de la Venta.", TipoMensaje.MsgError)
ObjFactura = Nothing
@@ -438,7 +467,7 @@ Partial Class Contratos_FacturacionMasiva
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
End Sub
- Private Sub CreaObjetosVenta(Etiqueta As String, Optional VistaPrevia As Boolean = False)
+ Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False)
Dim ObjFolios As New ClsGralFolios()
Dim Folio As String = ""
Dim Serie As String = ""
@@ -472,7 +501,7 @@ Partial Class Contratos_FacturacionMasiva
ObjFactura.MetodoPago = "Efectivo"
ObjFactura.FechaPago = DateTime.Today
ObjFactura.MotivoDescuento = ""
- ObjFactura.Observaciones = Etiqueta + " " + TxtObservaciones.Text + " " + DR("Observaciones").ToString
+ ObjFactura.Observaciones = TxtObservaciones.Text + " " + DR("Observaciones").ToString
ObjFactura.FechaEjecucion = DateTime.Today
'ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {1}")
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
@@ -553,9 +582,9 @@ Partial Class Contratos_FacturacionMasiva
DtR("CodigoPS") = row("CodigoPS")
DtR("SATClaveProdServ") = row("SATClaveProdServ")
DtR("NoIdentificacion") = row("NoIdentificacion")
- DtR("CveTipoPS") = DrPS("CveTipoPS")
- DtR("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
- DtR("Obs") = Etiqueta + " " + TxtObservaciones.Text + " " + row("Observacion").ToString
+ DtR("CveTipoPS") = drPS("CveTipoPS")
+ DtR("CveTipoInvPS") = drPS("Inv_CveMetodoInventario")
+ DtR("Obs") = TxtObservaciones.Text + " " + row("Observacion").ToString
DtR("PU") = row("PU")
DtR("IVA") = row("PorcentajeIVA")
DtR("PorcentajeIVA") = row("PorcentajeIVA")
diff --git a/Inventarios/EntregaAlmacen.aspx b/Inventarios/EntregaAlmacen.aspx
index 8d4ff3ea1..f3198fa5e 100644
--- a/Inventarios/EntregaAlmacen.aspx
+++ b/Inventarios/EntregaAlmacen.aspx
@@ -1,4 +1,4 @@
-<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EntregaAlmacen.aspx.vb" Inherits="Inventarios_EntregaAlmacen" %>
+<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EntregaAlmacen.aspx.vb" Inherits="Inventarios_EntregaAlmacen" enableEventValidation="false" %>
diff --git a/Inventarios/ResguardoMaterial.aspx.vb b/Inventarios/ResguardoMaterial.aspx.vb
index 460a99f76..320899cee 100644
--- a/Inventarios/ResguardoMaterial.aspx.vb
+++ b/Inventarios/ResguardoMaterial.aspx.vb
@@ -346,6 +346,11 @@ Partial Class Inventarios_ResguardoMaterial
ThSerie.Visible = True
TrSerie.Visible = True
TxtnSerie.Visible = True
+ Else
+ ThSerie.Visible = False
+ TrSerie.Visible = False
+ TxtnSerie.Visible = False
+ TxtnSerie.Text = ""
End If
'activa seccion
@@ -368,13 +373,19 @@ Partial Class Inventarios_ResguardoMaterial
If CBool(drp("AplicaLote")) Then
ThLote.Visible = True
TrLote.Visible = True
- 'TxtLote.Visible = True
+ Else
+ ThLote.Visible = False
+ TrLote.Visible = False
+ TxtLote.Text = ""
End If
'activa caducidad
If CBool(drp("AplicaCaducidad")) Then
ThCaducidad.Visible = True
TrCaducidad.Visible = True
- 'TxtCaducidad.Visible = True
+ Else
+ ThCaducidad.Visible = False
+ TrCaducidad.Visible = False
+ TxtCaducidad.Text = ""
End If
Else
diff --git a/Inventarios/TraspasoAlmacen.aspx b/Inventarios/TraspasoAlmacen.aspx
index 392b44f2c..b347d8638 100644
--- a/Inventarios/TraspasoAlmacen.aspx
+++ b/Inventarios/TraspasoAlmacen.aspx
@@ -164,7 +164,7 @@
-
+
diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb
index 1d6b6c93f..edb1228f1 100644
--- a/Inventarios/TraspasoAlmacen.aspx.vb
+++ b/Inventarios/TraspasoAlmacen.aspx.vb
@@ -204,7 +204,10 @@ Partial Class Inventarios_TraspasoAlmacen
Else
DivCodigoSeriePS.Visible = False
End If
- If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(0);$('#DivGastoIndirecto').show(0);$('#DivDocChofer').show(0);")
+ If ChkTransitorio.Checked Then
+ RegistraScript("$('#DivTransitorio').show(0);$('#DivGastoIndirecto').show(0);$('#DivDocChofer').show(0);")
+ DivTransitorio2.Visible = True
+ End If
If UsuarioActual.CveEmpresa.Contiene(1, 119) Then
DivEmitirTimbrado.Visible = True
@@ -226,7 +229,10 @@ Partial Class Inventarios_TraspasoAlmacen
TipoSeccionAlmacen = 0
Else
- If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(0);$('#DivGastoIndirecto').show(0);$('#DivDocChofer').show(0);")
+ If ChkTransitorio.Checked Then
+ RegistraScript("$('#DivTransitorio').show(0);$('#DivGastoIndirecto').show(0);$('#DivDocChofer').show(0);")
+ DivTransitorio2.Visible = True
+ End If
End If
End Sub
@@ -643,21 +649,21 @@ Partial Class Inventarios_TraspasoAlmacen
If TxtResponsable.Text.Trim = "" And Not UsuarioActual.CveEmpresa.Contiene(119) Then
Alert("Debe seleccionar un responsable para el traspaso transitorio.", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
- If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);")
+ If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);") : DivTransitorio2.Visible = True
Exit Sub
End If
If DdlAlmacenTransitorio.SelectedValue.ToEntero <= 0 Then
Alert("Debe seleccionar un almacen transitorio.", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
- If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);")
+ If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);") : DivTransitorio2.Visible = True
Exit Sub
End If
If DdlChofer.SelectedValue.ToEntero <= 0 And UsuarioActual.CveEmpresa.Contiene(119) Then
Alert("Debe seleccionar un Chofer", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')")
- If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);")
+ If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);") : DivTransitorio2.Visible = True
Exit Sub
End If
End If
@@ -693,7 +699,7 @@ Partial Class Inventarios_TraspasoAlmacen
Alert("Por ser un traspaso entre sucursales es necesario indicar que el traspaso es transitorio.", TipoMensaje.MsgAdvertencia)
RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'');", "SonidoError")
ChkTransitorio.Checked = True
- If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);", "MuestraDivTransitorio")
+ If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);", "MuestraDivTransitorio") : DivTransitorio2.Visible = True
Exit Sub
End If
End If
@@ -711,7 +717,7 @@ Partial Class Inventarios_TraspasoAlmacen
For Each dr As DataRow In DtMovimientos.Rows
If dr("EstatusExistencia").ToString = "-1" Then
Alert("Tiene que rectificar los movimientos con error.", TipoMensaje.MsgError)
- If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);")
+ If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);") : DivTransitorio2.Visible = True
Exit Sub
End If
Next
@@ -1456,10 +1462,11 @@ Partial Class Inventarios_TraspasoAlmacen
TxtResponsable.Text = ""
TxtGastoIndirecto.Text = ""
RegistraScript("$('#DivTransitorio').show(200);$('#DivGastoIndirecto').show(100);$('#DivDocChofer').show(100);")
-
+ DivTransitorio2.Visible = True
ChkEmitirTimbrado.Checked = LblEmitirTimbrado.Visible
Else
RegistraScript("$('#DivTransitorio').hide(500);$('#DivGastoIndirecto').hide(500);$('#DivDocChofer').hide(500);")
+ DivTransitorio2.Visible = True
End If
CargaAlmacenDestino()
@@ -1974,7 +1981,7 @@ Partial Class Inventarios_TraspasoAlmacen
CargaRecepcion()
Else
Alert("No hay movimientos para el traspaso", TipoMensaje.MsgAdvertencia)
- If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);")
+ If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);") : DivTransitorio2.Visible = True
End If
End Sub
diff --git a/OC/RepSolicitudesAnticipo.aspx b/OC/RepSolicitudesAnticipo.aspx
index 1cb414460..4c03a5549 100644
--- a/OC/RepSolicitudesAnticipo.aspx
+++ b/OC/RepSolicitudesAnticipo.aspx
@@ -117,6 +117,11 @@
+
+
+
+
+
diff --git a/OC/RepSolicitudesAnticipo.aspx.cs b/OC/RepSolicitudesAnticipo.aspx.cs
index 265ea97ca..ae72827e5 100644
--- a/OC/RepSolicitudesAnticipo.aspx.cs
+++ b/OC/RepSolicitudesAnticipo.aspx.cs
@@ -110,13 +110,13 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas
{
GvSolicitudes.Columns[4].Visible = true;
GvSolicitudes.Columns[5].Visible = true;
- GvSolicitudes.Columns[6].Visible = false;
+ GvSolicitudes.Columns[7].Visible = false;
}
else
{
GvSolicitudes.Columns[4].Visible = false;
GvSolicitudes.Columns[5].Visible = false;
- GvSolicitudes.Columns[6].Visible = true;
+ GvSolicitudes.Columns[7].Visible = true;
}
CargaDatos();
}
diff --git a/PyME/Contabilidad/RegPrePoliza.aspx.vb b/PyME/Contabilidad/RegPrePoliza.aspx.vb
index 965384706..43da76101 100644
--- a/PyME/Contabilidad/RegPrePoliza.aspx.vb
+++ b/PyME/Contabilidad/RegPrePoliza.aspx.vb
@@ -478,7 +478,7 @@ Partial Class Contabilidad_RegPrePoliza
For Each row As GridViewRow In GvPrePoliza.Rows
If Not ObjContabilidad.UpdatePrepolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCTextBox("TxtConcepto").Text, row.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero,
row.FCDropDownList("DdlCtaContable").SelectedValue.ToEntero, If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCTextBox("TxtCargo").Text.ToDecimal <> 0,
- row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal)) Then
+ row.FCTextBox("TxtCargo").Text.ToDecimal, row.FCTextBox("TxtAbono").Text.ToDecimal), CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
OcurrioError = True
End If
Next
diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx
index e9d329495..c2f070605 100644
--- a/Ventas/Ventas.aspx
+++ b/Ventas/Ventas.aspx
@@ -675,13 +675,24 @@
-
+
'); tr.append(td);
} else {
@@ -7857,5 +8082,21 @@
$('#ModalAplicarRemisionesNC').modal('hide');
}
+ var verficaRNC = function () {
+ var total = 0;
+ if ('<%= UsuarioActual.CveEmpresa %>' == '140') {
+ $(".ChkAplicaRNC > input").each(function () {
+ if (this.checked) {
+ total = total + 1;
+ }
+ if (total == 2) {
+ alert("No se puede seleccionar mas de una remisión de nota de crédito.");
+ this.checked = false;
+ return false;
+ }
+ });
+ }
+ };
+
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 40314494c..9d25b9949 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -112,6 +112,38 @@ Partial Class Ventas
ViewState("TmpDTDescNC") = value
End Set
End Property
+ Private Property TmpDTDescNCBonificacion As DataTable
+ Get
+ Return If(IsNothing(ViewState("TmpDTDescNCBonificacion")), Nothing, CType(ViewState("TmpDTDescNCBonificacion"), DataTable))
+ End Get
+ Set(value As DataTable)
+ ViewState("TmpDTDescNCBonificacion") = value
+ End Set
+ End Property
+ Private Property TmpDTBonificacion As DataTable
+ Get
+ Return If(IsNothing(ViewState("TmpDTBonificacion")), Nothing, CType(ViewState("TmpDTBonificacion"), DataTable))
+ End Get
+ Set(value As DataTable)
+ ViewState("TmpDTBonificacion") = value
+ End Set
+ End Property
+ Private Property TmpDTRNCBonificacionesCliente As DataTable
+ Get
+ Return If(IsNothing(ViewState("TmpDTRNCBonificacionesCliente")), Nothing, CType(ViewState("TmpDTRNCBonificacionesCliente"), DataTable))
+ End Get
+ Set(value As DataTable)
+ ViewState("TmpDTRNCBonificacionesCliente") = value
+ End Set
+ End Property
+ Private Property TmpDTRNCBonificacionesSeleccionadas As DataTable
+ Get
+ Return If(IsNothing(ViewState("TmpDTRNCBonificacionesSeleccionadas")), Nothing, CType(ViewState("TmpDTRNCBonificacionesSeleccionadas"), DataTable))
+ End Get
+ Set(value As DataTable)
+ ViewState("TmpDTRNCBonificacionesSeleccionadas") = value
+ End Set
+ End Property
Private Property TmpDTError As DataTable
Get
Return If(IsNothing(ViewState("TmpDTError")), Nothing, CType(ViewState("TmpDTError"), DataTable))
@@ -292,6 +324,14 @@ Partial Class Ventas
ViewState("ListaNCDesc") = value
End Set
End Property
+ Private Property ListaNCBonificacion As List(Of Modelos.Factura)
+ Get
+ Return If(IsNothing(ViewState("ListaNCBonificacion")), Nothing, CType(ViewState("ListaNCBonificacion"), List(Of Modelos.Factura)))
+ End Get
+ Set(value As List(Of Modelos.Factura))
+ ViewState("ListaNCBonificacion") = value
+ End Set
+ End Property
Private Property Pedidos2Lista As List(Of Integer)
Get
Return If(IsNothing(ViewState("Pedidos2Lista")), Nothing, CType(ViewState("Pedidos2Lista"), List(Of Integer)))
@@ -404,6 +444,15 @@ Partial Class Ventas
ViewState("RequiereAlmacenOrigen") = value
End Set
End Property
+
+ Private Property AplicoNCFacturaActual As Boolean
+ Get
+ Return If(IsNothing(ViewState("AplicoNCFacturaActual")), False, CType(ViewState("AplicoNCFacturaActual"), Boolean))
+ End Get
+ Set(value As Boolean)
+ ViewState("AplicoNCFacturaActual") = value
+ End Set
+ End Property
Private Property EmpresaActual As Empresa
Get
Return CType(ViewState("EmpresaActual"), Empresa)
@@ -1389,6 +1438,14 @@ Partial Class Ventas
ViewState("ObjFacturaDevolucion") = value
End Set
End Property
+ Private Property ObjFacturaBonificacion As Modelos.Factura
+ Get
+ Return CType(ViewState("ObjFacturaBonificacion"), Modelos.Factura)
+ End Get
+ Set(value As Modelos.Factura)
+ ViewState("ObjFacturaBonificacion") = value
+ End Set
+ End Property
Private Property ObjFacturaNC As Modelos.Factura
Get
Return CType(ViewState("ObjFacturaNC"), Modelos.Factura)
@@ -3269,6 +3326,8 @@ Partial Class Ventas
If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa, -1, -1, 1) Then
If ObjContratos.DtResultados.Rows.Count > 0 Then
+ Dim CveContratoTipo = ObjContratos.DtResultados.Rows(0)("CveContratoTipo").ToString.ToEntero
+
'Cargamos los datos del Cliente
DtContratos = ObjContratos.DtResultados
ViewState("CveCliente") = ObjContratos.DtResultados(0)("CveCliente").ToString().ToEntero()
@@ -3289,6 +3348,8 @@ Partial Class Ventas
BtnIniciarContrato_Click(Nothing, Nothing)
DdlContratosModal.SelectedValue = CveContrato.ToString()
DdlContratosModal_SelectedIndexChanged(Nothing, Nothing)
+ DdlAlmacenAsignado.Enabled = False
+ DdlAlmacenOrigen.Enabled = False
ElseIf TipoContrato = 0 Then
'Mostramos los almacenes
DdlAlmacenAsignado.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} {If(DdlTipoComprobante.SelectedValue = "Ped", "", "AND CveTipoAlmacen IN (4,10)")}")
@@ -3312,8 +3373,8 @@ Partial Class Ventas
DdlAlmacenAsignado.Items.Insert(0, New ListItem(dr("Almacen").ToString(), dr("CveAlmacen").ToString()))
End If
End If
- DdlAlmacenAsignado.SelectedValue = ObjContratos.CveAlmacen.ToString()
- DdlAlmacenAsignado.Enabled = False
+ DdlAlmacenAsignado.SelectedValueExist(ObjContratos.CveAlmacen.ToString())
+
Else
If (DdlAlmacenAsignado.Items.FindByValue("89") Is Nothing) Then
Dim dr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", "89"))
@@ -3322,20 +3383,31 @@ Partial Class Ventas
DdlAlmacenAsignado.Enabled = False
End If
End If
- DdlAlmacenAsignado.SelectedValue = "89"
+ DdlAlmacenAsignado.SelectedValueExist("89")
End If
If ObjContratos.CveAlmacenOrigen > 0 AndAlso TipoContrato = 0 Then
DdlAlmacenOrigen.Visible = True
RequiereAlmacenOrigen = True
+
+ If CveContratoTipo.Contiene(7, 9, 13, 21, 27) Then
+ Dim CveTipoAlmacenOrigen = "12,15"
+ If CveContratoTipo.Contiene(27) Then
+ CveTipoAlmacenOrigen = "1"
+ End If
+
+ DdlAlmacenOrigen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros($"CveSubProyecto = {DdlSubProyectoDatos.SelectedValue.ToEntero()} {If(DdlTipoComprobante.SelectedValue = "Ped", "", $"AND CveTipoAlmacen IN ({CveTipoAlmacenOrigen})")}")
+ DdlAlmacenOrigen.DataBind()
+ End If
+
If (DdlAlmacenOrigen.Items.FindByValue(ObjContratos.CveAlmacenOrigen.ToString()) Is Nothing) Then
Dim dr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", ObjContratos.CveAlmacenOrigen.ToString()))
If dr IsNot Nothing Then
DdlAlmacenOrigen.Items.Insert(0, New ListItem(dr("Almacen").ToString(), dr("CveAlmacen").ToString()))
End If
End If
- DdlAlmacenOrigen.SelectedValue = ObjContratos.CveAlmacenOrigen.ToString()
- DdlAlmacenOrigen.Enabled = False
+ DdlAlmacenOrigen.SelectedValueExist(ObjContratos.CveAlmacenOrigen.ToString())
+ DdlAlmacenOrigen.Enabled = True
End If
Else
@@ -4410,6 +4482,8 @@ Partial Class Ventas
If TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad") Then
BtnsFacturar.Visible = True
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
+
'ACTIVA CONVERSION DE MONEDA
If DdlMoneda.SelectedValue.ToEntero() = 1 Then
TrConversionDolares.Visible = True
@@ -4430,6 +4504,7 @@ Partial Class Ventas
Else
BtnsFacturar.Visible = False
End If
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
End If
End If
@@ -4461,6 +4536,7 @@ Partial Class Ventas
If TmpDT.SUM("CantidadFacturadaCot") < TmpDT.SUM("Cantidad") AndAlso DdlTipoComprobante.SelectedValue.Contiene("Cot") Then
BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True)
BtnsFacturar.Visible = True
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
End If
End If
@@ -5109,10 +5185,10 @@ Partial Class Ventas
End If
If UsuarioActual.Empresa.CvePlataforma = 2 Then LnkOCs.Visible = False
- If UsuarioActual.Empresa.UsaInventarios Then
- RblTipo.Items.Remove(RblTipo.Items.FindByValue("1"))
- RblTipo.Items.Remove(RblTipo.Items.FindByValue("2"))
- End If
+ 'If UsuarioActual.Empresa.UsaInventarios Then
+ ' RblTipo.Items.Remove(RblTipo.Items.FindByValue("1"))
+ ' RblTipo.Items.Remove(RblTipo.Items.FindByValue("2"))
+ 'End If
UpnTools.Update()
'UpRemisionesFacturas.Update()
@@ -5268,6 +5344,21 @@ Partial Class Ventas
If CveCliente > 0 Then CargaAnticipos(CveCliente) : UpAnticipos.Update()
+ If CveCliente > 0 AndAlso UsuarioActual.CveEmpresa = 140 Then
+ DivVentasUsados.Visible = True
+
+ Dim ObjClientes As New ClsClientes
+ If ObjClientes.GetHistorialVentas(CveCliente, 1000, CveClienteSucursal:=-1, TipoDocto:="Ing", CveEstatusFactura:=-1, FechaI:=Now.AddMonths(-1)) Then
+ DdlVentaUsado.DataSource = ObjClientes.DtResultados
+ End If
+ ObjClientes.Dispose()
+
+ DdlVentaUsado.DataBind()
+
+ DdlVentaUsado.Items.Insert(0, New ListItem("Seleccione", "-1"))
+
+ UpModalRemisionesNC.Update()
+ End If
If RequiereOC Then
Dim Documentacion As String = ""
@@ -5297,6 +5388,7 @@ Partial Class Ventas
' RegistraScript("$('#DivDocsClienteUpload').modal({ backdrop: 'static', keyboard: false});", "modalOC")
End If
BloqueaCondiconesPago()
+ DeshabilitarAplicarNotaDeCredito(LblRFC.Text)
End Sub
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1)
@@ -5355,6 +5447,7 @@ Partial Class Ventas
If Opcion = 1 Then
BtnEmitirImprimir.Visible = False
BtnsFacturar.Visible = False
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
BtnGenerarRemision.Visible = False
LnkPedido2SinFacturar.Visible = False
LnkCotizaciones.Visible = False
@@ -5407,6 +5500,7 @@ Partial Class Ventas
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant"))
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem"))
BtnsFacturar.Visible = False
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
BtnGenerarRemision.Visible = False
LnkPedido2SinFacturar.Visible = False
LnkCotizaciones.Visible = False
@@ -5445,6 +5539,7 @@ Partial Class Ventas
BtnGenerarOS.Visible = False
BtnEmitirImprimir.Visible = True
BtnsFacturar.Visible = False
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
Else
If DdlTipoComprobante.SelectedValue.Contiene("Pd2") Then
@@ -5454,6 +5549,7 @@ Partial Class Ventas
BtnGenerarOS.Visible = False
BtnEmitirImprimir.Visible = False
BtnsFacturar.Visible = False
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
If ViewState("CveCliente").ToString().ToEntero() <> ViewState("CveClienteAnterior").ToString().ToEntero() Then
If Opcion > 0 Then
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
@@ -7126,7 +7222,7 @@ Partial Class Ventas
'SI ES AMORTIZACION 3.3
Dim Obj2 As New List(Of Object)
- Dim NCDescuento As Boolean = (ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0)
+ Dim NCDescuento As Boolean = ((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0))
If ErrorList.Count = 0 Then
' cambiar la condicion para saber si hay seleccionado
If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse NCDescuento Then
@@ -7138,11 +7234,28 @@ Partial Class Ventas
CveVentaRelacionada = CveAnticipoPadre
End If
- CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
- If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
- Nothing, NCDescuento:=NCDescuento) Then
- Obj2.Add(ObjFacturaDevolucion)
+ If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse (ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) Then
+ CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
+ If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
+ Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDesc, IndexNC:=(DtVentasNC.Rows.Count - 1)) Then
+ Obj2.Add(ObjFacturaDevolucion)
+ End If
End If
+
+ If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
+ 'SI HAY UNA NOTA DE CREDITO REGISTRADA ANTERIORMENTE LIMPIA EL REGISTRO
+ If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
+ DtVentasNC.Rows.RemoveAt(DtVentasNC.Rows.Count - 1)
+ End If
+
+ CreaObjetosVentaBonificacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
+ If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaBonificacion, ObjBancos, Nothing,
+ Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCBonificacion, IndexNC:=(DtVentasNC.Rows.Count - 1)) Then
+ Obj2.Add(ObjFacturaBonificacion)
+ End If
+ End If
+
+
Catch ex As Exception
OnError("Ocurrió un error al generar nota de crédito de amortización", ex)
ErrorList.Add("No se pudo generar la nota de crédito de amortización")
@@ -7838,8 +7951,245 @@ Partial Class Ventas
End Sub
+ Private Sub CreaObjetosVentaBonificacion(ObjVentas As ClsVentas, FolioFiscalRelacionado As String, CveAnticipoPadre As Integer,
+ Optional CveVentasPadre As Integer = -1, Optional NCDescuento As Boolean = False)
+ ObjFacturaBonificacion = New Modelos.Factura
+
+ ObjFacturaBonificacion.CveUsuario = UsuarioActual.CveUsuario
+ ObjFacturaBonificacion.CveSubProyecto = DdlSubProyectoDatos.SelectedValue.ToEntero()
+
+ If CveVentasPadre > 0 Then
+ ObjFacturaBonificacion.CveVentaPadre = CveVentasPadre
+ ObjFacturaBonificacion.CveVentaRelacion = CveVentasPadre
+ Else
+ ObjFacturaBonificacion.CveVentaPadre = ObjVentas.CveVenta
+ ObjFacturaBonificacion.CveVentaRelacion = ObjVentas.CveVenta
+ End If
+
+ ObjFacturaBonificacion.CveEmpresa = UsuarioActual.CveEmpresa
+ ObjFacturaBonificacion.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal)
+ ObjFacturaBonificacion.ConvertirPesos = ChkConvertirDoctoPesos.Checked
+ ObjFacturaBonificacion.CveMoneda = DdlMoneda.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.Moneda = DdlMoneda.SelectedItem.Text
+ ObjFacturaBonificacion.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {DdlMoneda.SelectedValue}")
+ 'ObjFacturaDevolucion.RefDocto = TxtDocto.Text.Trim
+ 'ObjFacturaDevolucion.Folio = If(ExFolioFactura, FolioXML.ToEntero(), -1)
+ ObjFacturaBonificacion.Serie = LblSerie.Text
+ ObjFacturaBonificacion.Fecha = New Date(TxtFecha.Text.Trim.ToDate.Year, TxtFecha.Text.Trim.ToDate.Month, TxtFecha.Text.Trim.ToDate.Day, Now.Hour, Now.Minute, Now.Second)
+ ObjFacturaBonificacion.CvePrePoliza = -1
+ ObjFacturaBonificacion.CveMetodoPago = 0 'DdlMetodoPago.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.MetodoPago = ""
+ ObjFacturaBonificacion.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}")
+ ObjFacturaBonificacion.UsuarioCreo = LblUsuario.Text.Trim
+ ' ObjFacturaDevolucion.CveCondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedValue.ToEntero(), -1)
+ ' ObjFacturaDevolucion.CondicionEntrega = If(DdlFormaEntrega.SelectedItem IsNot Nothing, DdlFormaEntrega.SelectedItem.Text, "")
+ 'ObjFacturaDevolucion.NumeroCuenta = TxtNumCtaPago.Text.Trim
+ 'ObjFacturaDevolucion.Cliente.NumCtaPago = TxtNumCtaPago.Text.Trim
+ ObjFacturaBonificacion.CondicionesPago = If(RBLPago.SelectedValue = "2", 0, 1) ' 0 - Contado, 1 - Credito
+ ObjFacturaBonificacion.FormaPago = 0
+
+ ObjFacturaBonificacion.TipoDocto = "Egs"
+ ObjFacturaBonificacion.Fecha = Now
+
+ ObjFacturaBonificacion.Version = "3.3"
+ ObjFacturaBonificacion.CveMetodoPago33 = 1
+ ObjFacturaBonificacion.MetodoPago33 = "Pago en una sola exhibición"
+ ObjFacturaBonificacion.ClaveMetodoPagoSAT = "PUE"
+
+ ObjFacturaBonificacion.CveFormaPago33 = 21
+ ObjFacturaBonificacion.FormaPago33 = "Aplicación de anticipos"
+ ObjFacturaBonificacion.FormaPagoSAT33 = "30"
+
+ ObjFacturaBonificacion.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.UsoCFDI = DdlUsoCFDI.SelectedItem.Text
+ ObjFacturaBonificacion.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}")
+
+ ObjFacturaBonificacion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.TipoRelacion = "07"
+
+ Dim Fol As New List(Of String)
+ Fol.Add(FolioFiscalRelacionado)
+ ObjFacturaBonificacion.UUIDRelacionados = Fol
+
+ Select Case ObjFacturaBonificacion.TipoDocto
+ Case "Ing"
+ ObjFacturaBonificacion.TipoDocumento = "Factura"
+ Case "REM"
+ ObjFacturaBonificacion.TipoDocumento = "Remision"
+ Case "Cot"
+ ObjFacturaBonificacion.TipoDocumento = "Cotizacion"
+ Case "Egs"
+ ObjFacturaBonificacion.TipoDocumento = "Nota de Crédito"
+ Case "Dev"
+ ObjFacturaBonificacion.TipoDocumento = "Nota de Devolución"
+ Case Else
+ ObjFacturaBonificacion.TipoDocumento = ""
+ End Select
+
+ If ObjFacturaBonificacion.TipoDocto IsNot Nothing Then
+ ViewState("TipoDoctoDevolucion") = ObjFacturaBonificacion.TipoDocto
+ End If
+
+ ObjFacturaBonificacion.Fech1 = TxtFech1.Text.Trim.ToDate
+ ObjFacturaBonificacion.Fech2 = TxtFech2.Text.Trim.ToDate
+ ObjFacturaBonificacion.Fech3 = TxtFech3.Text.Trim.ToDate
+ ObjFacturaBonificacion.Alfa1 = TxtAlfa1.Text.Trim
+ ObjFacturaBonificacion.Alfa2 = TxtAlfa2.Text.Trim
+ ObjFacturaBonificacion.Alfa3 = TxtAlfa3.Text.Trim
+ ObjFacturaBonificacion.Num1 = TxtNum1.Text.Trim.ToDouble
+ ObjFacturaBonificacion.Num2 = TxtNum2.Text.Trim.ToDouble
+ ObjFacturaBonificacion.Num3 = If(ObjFacturaBonificacion.TipoDocto = "OP", DdlOrdenPago.SelectedValue.ToDouble, TxtNum3.Text.Trim.ToDouble)
+ ObjFacturaBonificacion.FechaPago = TxtFechaPago.Text.ToDate
+
+ ObjFacturaBonificacion.CveCorte = CveCorte
+ ObjFacturaBonificacion.CveMesa = -1
+ ObjFacturaBonificacion.NumeroPersonas = 0
+ ObjFacturaBonificacion.CveContrato = If(CveContrato > 0, CveContrato, CvePresupuesto)
+ ObjFacturaBonificacion.DescripcionContrato = If(DdlContratosModal.SelectedItem IsNot Nothing, DdlContratosModal.SelectedItem.Text, "")
+ ObjFacturaBonificacion.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.Entrega = Entrega
+ ObjFacturaBonificacion.Vigencia = TxtFechaVencimientoCotizacion.Text.ToDate
+
+ ObjFacturaBonificacion.CveVentaPadre = CveAnticipoPadre
+ ObjFacturaBonificacion.CveVendedor = DdlVendedor.SelectedValue.ToEntero()
+ If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
+ DdlVendedor.Enabled = False
+ End If
+
+ ObjFacturaBonificacion.FechaEjecucion = TxtFechaEjecucion.Text.Trim.ToDate
+ ObjFacturaBonificacion.CveSucursalEjecucion = DdlSucursalEjecucion.SelectedValue.ToEntero()
+ ObjFacturaBonificacion.CveSucursalCobranza = DdlSucursalCobranza.SelectedValue.ToEntero()
+
+ ObjFacturaBonificacion.AtencionA = If(ObjFacturaBonificacion.TipoDocto = "Cot" Or (ObjFacturaBonificacion.TipoDocto.Contiene("Ing", "Rem") AndAlso LblRFC.Text = "XAXX010101000"), TxtAtencionA.Text, "-1")
+ ObjFacturaBonificacion.MotivoDescuento = TxtMotivoDescuento.Text.Trim
+ ObjFacturaBonificacion.Observaciones = TxtObsFact.Text.Trim
+ ObjFacturaBonificacion.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim
+ ObjFacturaBonificacion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
+ ObjFacturaBonificacion.MonedaAbreviatura = ""
+
+ If TmpDTImpuestos Is Nothing Then
+ CreaDTImpuestos()
+ Else
+ TmpDTImpuestos.Clear()
+ End If
+
+ Dim DR As DataRow = TmpDTImpuestos.NewRow()
+
+ If TxtSubTotal.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "SubTotal" : DR("Importe") = TxtSubTotal.Text.ToDecimal : DR("Orden") = 10 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ If LblDescuentos.Text.Trim.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Descuentos" : DR("Importe") = LblDescuentos.Text.Trim.ToDecimal : DR("Orden") = 20 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ If LblAmortizacion.Text.Trim.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Amort.Ant" : DR("Importe") = LblAmortizacion.Text.Trim.ToDecimal : DR("Orden") = 30 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ If TxtSubTotal2.Text.ToDecimal <> TxtSubTotal.Text.ToDecimal Then DR("ImpuestoLocal") = "SubTotal 2" : DR("Importe") = TxtSubTotal2.Text.ToDecimal : DR("Orden") = 40 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ If TxtIVA.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "IVA" : DR("Importe") = TxtIVA.Text.ToDecimal : DR("Orden") = 50 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+
+ If TxtRetIVA.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Ret.IVA" : DR("Importe") = TxtRetIVA.Text.ToDecimal : DR("Orden") = 60 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ If TxtRetISR.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Ret.ISR" : DR("Importe") = TxtRetISR.Text.ToDecimal : DR("Orden") = 70 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+
+
+ 'If DdlFormatoImpresion.SelectedValue.ToEntero() = 3 Or DdlFormatoImpresion.SelectedValue.ToEntero() = 4 Then
+ ' DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (TxtSubTotal.Text.ToDecimal + TxtIVA.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal) : DR("Orden") = 55 : TmpDTImpuestos.Rows.Add(DR)
+
+ ' DR = TmpDTImpuestos.NewRow()
+ 'End If
+
+ For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
+ If gvr.RowType = DataControlRowType.DataRow Then
+ Dim Orden As Integer = 80
+ If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal > 0 Then
+ DR("ImpuestoLocal") = gvr.DataKey("ImpuestoLocal").ToString() : DR("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal.RoundSQL(2) : DR("Orden") = Orden : DR("Porcentaje") = gvr.DataKey("Porcentaje").ToString() : DR("TipoImpuesto") = gvr.DataKey("TipoImpuesto").ToString() : DR("IdCtaContable") = gvr.DataKey("IdCtaContable").ToString().ToEntero() : TmpDTImpuestos.Rows.Add(DR)
+ DR = TmpDTImpuestos.NewRow()
+ Orden = Orden + 1
+ End If
+ End If
+ Next
+
+ If TxtTotal.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = TxtTotal.Text.ToDecimal : DR("Orden") = 100 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
+
+ ObjFacturaBonificacion.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC")
+
+ 'DETALLES
+ PreparaNCBonificacion(ObjFacturaBonificacion)
+
+ 'otros
+ ObjFacturaBonificacion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
+ ObjFacturaBonificacion.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim
+
+
+ ObjFacturaBonificacion.CveNCaVincular = DdlNCFactura.SelectedValue.ToEntero()
+
+ If ObjFacturaBonificacion.CveMoneda <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then
+ ObjFacturaBonificacion.TipoCambio = 1
+ ObjFacturaBonificacion.CveMoneda = 1
+ End If
+
+ ObjFacturaBonificacion.DtFirmas = DTmpF
+
+ 'CLIENTE
+ ObjFacturaBonificacion.CveCliente = CveCliente
+ ObjFacturaBonificacion.SetCliente()
+
+ ''SUCURSAL
+ 'ObjFacturaBonificacion.CveSucursal = DdlSucursal.SelectedValue.ToEntero()
+ 'ObjFacturaBonificacion.SetSucursalMatriz(Me)
+ 'ObjFacturaBonificacion.SetSucursal(Me)
+
+ ObjFacturaBonificacion.ClienteSucursal = New Modelos.SucursalModel
+ ObjFacturaBonificacion.ClienteSucursal.NoExt = CliNoExt
+ ObjFacturaBonificacion.ClienteSucursal.NoInt = CliNoInt
+ ObjFacturaBonificacion.ClienteSucursal.Localidad = CliLocalidad
+ ObjFacturaBonificacion.ClienteSucursal.Direccion = LblDireccion.Text
+ ObjFacturaBonificacion.ClienteSucursal.Colonia = LblColonia.Text
+ ObjFacturaBonificacion.ClienteSucursal.Municipio = LblCiudad.Text
+ ObjFacturaBonificacion.ClienteSucursal.Estado = LblEstado.Text
+ ObjFacturaBonificacion.ClienteSucursal.CP = LblCP.Text
+ ObjFacturaBonificacion.ClienteSucursal.Pais = CliPais
+ ObjFacturaBonificacion.ClienteSucursal.CorreoSucursal = CliCorreoCot.ToString()
+ ObjFacturaBonificacion.ClienteSucursal.TelefonoSucursal = LblTelefono.Text
+ ObjFacturaBonificacion.ClienteSucursal.Sucursal = If(DdlSucursalCliente.SelectedValue.ToEntero() > 0, DdlSucursalCliente.SelectedItem.Text, "")
+
+
+
+ ObjFacturaBonificacion.SetSubProyectoMatriz(Me)
+ ObjFacturaBonificacion.SetSubProyecto(Me)
+
+ 'ENVIO DIRECCION
+ ObjFacturaBonificacion.EnviarA = New Modelos.EnviarAModel
+ If ChkDireccionEnvio.Checked Then
+ If TmpDTEnvioDireccion IsNot Nothing AndAlso TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows.Count > 0 Then
+ For Each Row As DataRow In TmpDTEnvioDireccion.FiltraParametros(String.Format("CveDireccionEnvio = {0}", DdlDireccionEnvio.SelectedValue.ToEntero())).Rows
+ ObjFacturaBonificacion.EnviarA.CveDireccionEnvio = Row("CveDireccionEnvio").ToString().ToEntero()
+ ObjFacturaBonificacion.EnviarA.EnvioDireccion = Row("EnvioDireccion").ToString()
+ ObjFacturaBonificacion.EnviarA.EnvioColonia = Row("EnvioColonia").ToString()
+ ObjFacturaBonificacion.EnviarA.EnvioCiudad = Row("EnvioCiudad").ToString()
+ ObjFacturaBonificacion.EnviarA.EnvioEstado = Row("EnvioEstado").ToString()
+ ObjFacturaBonificacion.EnviarA.EnvioCP = Row("EnvioCP").ToString()
+ Next
+ End If
+ End If
+
+ 'SI NO ES REFACTURACION
+ If NuevaFactura <> 1 Then
+ If DtVentasNC Is Nothing Then InicializaDTVentasNC()
+ Dim Drt = DtVentasNC.NewRow
+ Drt("CveVenta") = ObjFactura.CveVenta
+ Drt("Importe") = 0
+ Drt("FolioFiscal") = ObjFactura.FolioFiscal
+ DtVentasNC.Rows.Add(Drt)
+ DtVentasNC.AcceptChanges()
+ End If
+
+ End Sub
+
+
Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi,
- ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos, Optional NCDescuento As Boolean = False) As Boolean
+ ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos, Optional NCDescuento As Boolean = False,
+ Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional IndexNC As Integer = 0) As Boolean
Dim ProcesoCorrecto As Boolean = True
'GENERAMOS EL NUEVO FOLIO
@@ -7858,16 +8208,16 @@ Partial Class Ventas
If NCDescuento Then
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
- DtVentasNC.Rows(0)("Importe") = factura.Total
- DtVentasNC.Rows(0)("TC") = factura.TipoCambio
- DtVentasNC.Rows(0)("TCCambioValuacion") = factura.TipoCambio
+ DtVentasNC.Rows(IndexNC)("Importe") = factura.Total
+ DtVentasNC.Rows(IndexNC)("TC") = factura.TipoCambio
+ DtVentasNC.Rows(IndexNC)("TCCambioValuacion") = factura.TipoCambio
End If
- factura.Timbre = PreParaTimbre(ObjFacturaDevolucion)
+ factura.Timbre = PreParaTimbre(factura)
factura.CveVentaPadre = Me.CveVenta
'Registramos la venta
- GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True, NCDescuento:=True)
+ GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=False, NCDescuento:=True, ListaNCDescuento:=ListaNCDescuento)
Else
'GENERO LOS DATOS DE LA NC
@@ -9508,7 +9858,7 @@ Partial Class Ventas
#Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO "
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer,
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing,
- ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False)
+ ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing)
Dim Msgok As New StringBuilder
Dim CveAlmacenTraspasoOrigen As Integer = -1
@@ -9864,7 +10214,7 @@ Partial Class Ventas
If ErrorList.Count = 0 Then
'prepoliza
- GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento)
+ GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento)
If ErrorList.Count = 0 Then
'INVENTARIOS
@@ -9898,7 +10248,8 @@ Partial Class Ventas
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer,
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
- ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ValorMultiplicador As Integer = 1)
+ ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False,
+ Optional ValorMultiplicador As Integer = 1, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing)
Dim CveIE As Integer = -1
Dim DT As DataTable = Nothing
@@ -9917,7 +10268,7 @@ Partial Class Ventas
If DdlTipoComprobante.SelectedValue <> "Cot" Then
If factura.CvePrePoliza > 0 Then
- If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, ValorMultiplicador, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento) Then
+ If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, ValorMultiplicador, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento) Then
ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza. Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
End If
@@ -9928,7 +10279,7 @@ Partial Class Ventas
End Sub
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi,
Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
- ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False) As Boolean
+ ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing) As Boolean
Try
Dim DT As DataTable
Dim CvePlantilaPoliza As Integer
@@ -10268,91 +10619,100 @@ Partial Class Ventas
If EsNCAmortizacion Then
'' aqui no se registra el pago como NC, se deja para el registro de la aplicaion del anticipo
'' esto para trasladar los impuestos.
- If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") Then
- For Each row2 As GridViewRow In GVAnticipos.Rows
- If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then
- If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then
- CveIEAnticipo = row2.DataKey("CveIE").ToString().ToEntero()
- importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
- Dim ImporteAnticipo As Decimal = importeMovimiento
- If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
+ If Not AplicoNCFacturaActual Then
+ If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") Then
- If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then ImporteAnticipo = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal * row2.DataKey("SubTotalAnticipo").ToDecimal
+ For Each row2 As GridViewRow In GVAnticipos.Rows
+ If row2.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then
+ If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then
+ CveIEAnticipo = row2.DataKey("CveIE").ToString().ToEntero()
+ importeMovimiento = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
+ Dim ImporteAnticipo As Decimal = importeMovimiento
+ If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
- IdCtaContable = IdCtaContAnticipos
- CveCuenta = CveCuentaAnticipos
- CveSubProyectoContabilizar = CveSubProyectoVenta
+ If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then ImporteAnticipo = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal * row2.DataKey("SubTotalAnticipo").ToDecimal
- If importeMovimiento <> 0 Then
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
- ErrorPrepoliza = True
- Exit For
- Else
- ViewState("SeGuardoPrePoliza") = True
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
+ IdCtaContable = IdCtaContAnticipos
+ CveCuenta = CveCuentaAnticipos
+ CveSubProyectoContabilizar = CveSubProyectoVenta
+
+ If importeMovimiento <> 0 Then
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
- End If
- 'se hace acreditamiento de impuestos
- 'IVA X TRASLADAR
- Dim EsAnticipoEspecial As Boolean = False
+ Else
+ ViewState("SeGuardoPrePoliza") = True
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 2, Concepto, FechaMovimiento, ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, CveIE:=CveIEAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+ 'se hace acreditamiento de impuestos
+ 'IVA X TRASLADAR
+ Dim EsAnticipoEspecial As Boolean = False
- If UsuarioActual.CveEmpresa.Contiene(1, 119) Then EsAnticipoEspecial = True
- If EsAnticipoEspecial Then
- Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal
- '' si se esta aplicando NC por amortizaion, se trasladan impuestos
- If EsNCAmortizacion Then
- Dim IngresoIVA As Decimal = TxtIVA.Text.ToDecimal
- Dim IngresoIEPS As Decimal = TxtIEPS.Text.ToDecimal
- Dim IngresoTotal As Decimal = TxtTotal.Text.ToDecimal
+ If UsuarioActual.CveEmpresa.Contiene(1, 119) Then EsAnticipoEspecial = True
+ If EsAnticipoEspecial Then
+ Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal
+ '' si se esta aplicando NC por amortizaion, se trasladan impuestos
+ If EsNCAmortizacion Then
+ Dim IngresoIVA As Decimal = TxtIVA.Text.ToDecimal
+ Dim IngresoIEPS As Decimal = TxtIEPS.Text.ToDecimal
+ Dim IngresoTotal As Decimal = TxtTotal.Text.ToDecimal
- If IngresoIVA > 0 Then
+ If IngresoIVA > 0 Then
- IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
- ErrorPrepoliza = True
- Exit For
- End If
- 'IVA PAGADO
- IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
- If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
- ErrorPrepoliza = True
- Exit For
- End If
- End If
-
-
- If IngresoIEPS > 0 Then
- 'IEPS X TRASLADAR
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
- If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
- ErrorPrepoliza = True
- Exit For
+ IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+ 'IVA PAGADO
+ IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIVA) / IngresoTotal, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIVA) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
End If
- 'IEPS PAGADO
- Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
- If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
- ErrorPrepoliza = True
- Exit For
+
+ If IngresoIEPS > 0 Then
+ 'IEPS X TRASLADAR
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
+ If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
+
+ 'IEPS PAGADO
+ Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, Dr("Folio").ToString, FolioIE.ToString())
+ If IngresoIEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, (importeMovimiento * IngresoIEPS) / IngresoTotal, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=((importeMovimiento * IngresoIEPS) / IngresoTotal) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
End If
End If
End If
+
+
+
End If
-
-
-
End If
+
End If
-
End If
- End If
- Next
+ Next
+ End If
+ ElseIf AplicoNCFacturaActual AndAlso ChkAplicaNCAnticipo.Checked Then
+ If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
+ ErrorPrepoliza = True
+ Exit For
+ End If
End If
+
Else
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, Importe251, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=Dr("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, ImporteMX:=ImporteMN251, ImporteME:=If(Dr("TCCambioValuacion").ToString().ToDecimal = 1, 0, Importe251), CveSubProyecto:=CveSubProyectoContabilizar, CveVentaAmortizacion:=ObjFactura.CveVenta, TipoCambio:=Dr("TCCambioValuacion").ToString().ToDecimal, TipoCambioPago:=tipoCambio) Then
ErrorPrepoliza = True
@@ -10729,7 +11089,7 @@ Partial Class Ventas
Dim ListaNC As List(Of Modelos.Factura) = Nothing
If NCDescuento Then
- ListaNC = ListaNCDesc
+ ListaNC = ListaNCDescuento
Else
ListaNC = ListaRemisionesNC
End If
@@ -15033,43 +15393,47 @@ Partial Class Ventas
Private Sub AgregarPS()
'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL)
- Dim CvePS As Integer = -1
- If DIVCod.Visible Then
- CvePS = HdnCvePS.Value.ToEntero()
- Else
- CvePS = DdlPS.SelectedValue.ToEntero()
- End If
-
- If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero(), TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero()) Then
-
- If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then
- CvePSAmortizacion = DdlPS.SelectedValue.ToEntero().ToEntero()
+ Try
+ Dim CvePS As Integer = -1
+ If DIVCod.Visible Then
+ CvePS = HdnCvePS.Value.ToEntero()
+ Else
+ CvePS = DdlPS.SelectedValue.ToEntero()
End If
- Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal
- Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal)
- Dim ObjDescuento As Descuentos = CalcularDescuentos(CvePS, Cantidad, PU)
- If ObjDescuento.EsPUModificado Then
- PU = ObjDescuento.PU
+ If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero(), TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero()) Then
+
+ If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then
+ CvePSAmortizacion = DdlPS.SelectedValue.ToEntero().ToEntero()
+ End If
+
+ Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal
+ Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal)
+ Dim ObjDescuento As Descuentos = CalcularDescuentos(CvePS, Cantidad, PU)
+ If ObjDescuento.EsPUModificado Then
+ PU = ObjDescuento.PU
+ End If
+
+ AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero(), DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero(), DdlClasificacion.SelectedItem.Text,
+ CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento,
+ DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text,
+ Serie:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle)
+
+ CalculaUsados()
+
+ CalculaTotalesVenta()
+
+ LimpiaAgregar()
+
+ 'SI EL PORLET DE COMERCIO EXTERIOR EXTERIOR ESTA VISIBLE SE ACTUALIZAN LOS PRODUCTOS DEL GRIDVIEW
+ If AplicaComercioExterior Then
+ CargaGvComercioExterior()
+ End If
End If
-
- AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero(), DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero(), DdlClasificacion.SelectedItem.Text,
- CvePS, "", TxtObsPS.Text.Trim, PU, ObjDescuento.ImporteDescuento,
- DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text,
- Serie:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle)
-
- CalculaUsados()
-
- CalculaTotalesVenta()
-
- LimpiaAgregar()
-
- 'SI EL PORLET DE COMERCIO EXTERIOR EXTERIOR ESTA VISIBLE SE ACTUALIZAN LOS PRODUCTOS DEL GRIDVIEW
- If AplicaComercioExterior Then
- CargaGvComercioExterior()
- End If
- End If
- UpPS.Update()
+ UpPS.Update()
+ Catch ex As Exception
+ OnError("Ocurrió un error al agregar el producto", ex)
+ End Try
End Sub
@@ -15190,7 +15554,7 @@ Partial Class Ventas
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0,
- Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1) As Boolean
+ Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False) As Boolean
Dim Retorno As Boolean = False
If Not CvePS > 0 Then
@@ -15236,6 +15600,8 @@ Partial Class Ventas
Row("CvePS") = CvePS
Row("Obs") = Obs
+
+
Dim DrPS As DataRow = Nothing
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
@@ -15360,6 +15726,7 @@ Partial Class Ventas
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
Row("CuentaPredial") = CuentaPredial
Row("EsOutSourcing") = DrPS("EsOutSourcing")
+ Row("EsCargo") = EsCargo
If UsuarioActual.CveEmpresa = 119 Then
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
@@ -15574,6 +15941,7 @@ Partial Class Ventas
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
TmpDT.Columns("EsOutSourcing").DefaultValue = False
+ TmpDT.Columns("EsCargo").DefaultValue = False
End Sub
Private Sub CreaDTmpC()
@@ -18496,7 +18864,7 @@ Partial Class Ventas
End If
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
- Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, LblTotalNC.Text.Trim().ToDecimal(), 0)
+ Dim TotalNC As Decimal = If((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0), LblTotalNC.Text.Trim().ToDecimal(), 0)
If TotalNC > 0 Then
If (DtPagos.SUM("Importe").ToString().ToDecimal() + AmortizacionNC + Total - TxtCambio.Text.ToDecimal) > TotalNC Then
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
@@ -18754,14 +19122,15 @@ Partial Class Ventas
If ObjInv.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjInv.DtResultados.Rows.Count > 0 Then
CargaGVInv(ObjInv.DtResultados)
- Else
- 'si es la empresa 119, Candado, no permiter refacturar, si no se ha surtido, para que cancele la factura mejor.
- If UsuarioActual.CveEmpresa = 119 AndAlso LkRefacturacion.Visible AndAlso ObjInv.DtResultados.Rows.Count = 0 Then
- LkRefacturacion.Visible = False
- End If
End If
End If
ObjInv.Dispose()
+
+ 'si es la empresa 119, Candado, no permiter refacturar, si no se ha surtido, para que cancele la factura mejor.
+ If UsuarioActual.CveEmpresa = 119 AndAlso LkRefacturacion.Visible AndAlso VentaSaldoAlmacen = 0 Then
+ LkRefacturacion.Visible = False
+ End If
+
End Sub
Private Sub CargaGVInv(DtTemporal As DataTable)
@@ -21048,7 +21417,7 @@ Partial Class Ventas
If CveMovimientoEntradaGeneral > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
- If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=-3, Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
+ If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then
Return False
End If
Next
@@ -22402,6 +22771,10 @@ Partial Class Ventas
UpAplicarNC.Update()
End Sub
+ Protected Sub DdlVentaUsado_SelectedIndexChanged(sender As Object, e As EventArgs)
+ CargaRNC(DdlVentaUsado.SelectedValue.ToEntero())
+ End Sub
+
Private Sub InicializaAplicarNCMasiva()
'If Not UsuarioActual.CveUsuario = 100 Then
@@ -22439,28 +22812,164 @@ Partial Class Ventas
ObjMovtos.Dispose()
GvCxC.DataBind()
End Sub
- Private Sub CargaRNC()
- Dim ObjMovtos As New ClsMovimientos()
+ Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1)
+ Dim DtNC As DataTable = Nothing
+ Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
- GvRemisionesNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
+ DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
End If
ObjMovtos.Dispose()
+
+ TmpDTRNCBonificacionesSeleccionadas = Nothing
+
+ GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1")
+ GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
+
+ Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
+ Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
+ Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
+
GvRemisionesNC.DataBind()
+ GvRemisionesNCBon.DataBind()
+
+ If CveVentaUsado > 0 Then
+ Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa)
+ LtlSMU.Text = String.Format("{0:N2}", FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal())
+ Else
+ LtlSMU.Text = String.Format("{0:N2}", 0)
+ End If
+
UpModalRemisionesNC.Update()
End Sub
Private Sub CargaDescRNC()
-
+ Dim DtNC As DataTable = Nothing
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
- GvDescNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
+ DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
End If
ObjMovtos.Dispose()
- GvDescNC.DataBind()
+
+ TmpDTRNCBonificacionesSeleccionadas = Nothing
+
+ GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1")
+ GvDescNCBonificaciones.DataSource = TmpDTRNCBonificacionesSeleccionadas
+
+ Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
+ Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
+ Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
+
+ GvDescNCCargos.DataBind()
+ GvDescNCBonificaciones.DataBind()
+
+ LblSaldoMaximoUsados.Text = String.Format("{0:N2}", Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal())
UpDescNC.Update()
End Sub
- Protected Sub GvDescNC_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNC.RowDataBound
+
+ Protected Sub ChkAplicarRNC_CheckedChanged(sender As Object, e As EventArgs)
+ Dim ChkAplicarRNC As CheckBox = DirectCast(sender, CheckBox)
+ Dim GvRow As GridViewRow = DirectCast(ChkAplicarRNC.NamingContainer, GridViewRow)
+
+ If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
+ TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
+ End If
+
+ Dim CveVentaBonificacion As Integer = -1
+ Dim ImporteBonificacion As Decimal = 0
+ Using ObjAcum As New ClsAcumuladores
+ If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then
+ Dim RowMovto As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
+
+ CveVentaBonificacion = RowMovto("CveVentaBonificacion").ToString().ToEntero()
+ ImporteBonificacion = RowMovto("ImporteBonificacion").ToString().ToDecimal()
+ End If
+ End Using
+
+ If CveVentaBonificacion > 0 Then
+ Dim RowBonificacion As DataRow = Me.TmpDTRNCBonificacionesCliente.FiltroPrimero($"CveVenta = {CveVentaBonificacion}")
+ RowBonificacion("ImporteBonificacion") = ImporteBonificacion
+ RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero()
+
+ If ChkAplicarRNC.Checked Then
+ TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
+ Else
+ Dim RowEliminar As DataRow = Me.TmpDTRNCBonificacionesSeleccionadas.Select($"CveVenta = {CveVentaBonificacion}").FirstOrDefault()
+ TmpDTRNCBonificacionesSeleccionadas.Rows.Remove(RowEliminar)
+ End If
+
+ End If
+
+ 'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS
+ If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then
+ DivRNCBonificaciones.Visible = True
+ Else
+ DivRNCBonificaciones.Visible = False
+ End If
+
+ GvDescNCBonificaciones.DataSource = TmpDTRNCBonificacionesSeleccionadas
+ GvDescNCBonificaciones.DataBind()
+
+ LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal())
+
+ UpDescNC.Update()
+
+ End Sub
+ Protected Sub ChkAplicarNCBon_CheckedChanged(sender As Object, e As EventArgs)
+ Dim ChkAplicarRNC As CheckBox = DirectCast(sender, CheckBox)
+ Dim GvRow As GridViewRow = DirectCast(ChkAplicarRNC.NamingContainer, GridViewRow)
+
+ If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
+ TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
+ End If
+
+ Dim CveVentaBonificacion As Integer = -1
+ Dim ImporteBonificacion As Decimal = 0
+ Using ObjAcum As New ClsAcumuladores
+ If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then
+ Dim RowMovto As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
+
+ CveVentaBonificacion = RowMovto("CveVentaBonificacion").ToString().ToEntero()
+ ImporteBonificacion = RowMovto("ImporteBonificacion").ToString().ToDecimal()
+ End If
+ End Using
+
+ If CveVentaBonificacion > 0 Then
+ Dim RowBonificacion As DataRow = Me.TmpDTRNCBonificacionesCliente.FiltroPrimero($"CveVenta = {CveVentaBonificacion}")
+ RowBonificacion("ImporteBonificacion") = ImporteBonificacion
+ RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero()
+
+ If ChkAplicarRNC.Checked Then
+ TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
+ Else
+ Dim RowEliminar As DataRow = Me.TmpDTRNCBonificacionesSeleccionadas.Select($"CveVenta = {CveVentaBonificacion}").FirstOrDefault()
+ TmpDTRNCBonificacionesSeleccionadas.Rows.Remove(RowEliminar)
+ End If
+
+ End If
+
+ 'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS
+ If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then
+ DivRNCBon.Visible = True
+ Else
+ DivRNCBon.Visible = False
+ End If
+
+ GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
+ GvRemisionesNCBon.DataBind()
+
+ LtlSMUBon.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal())
+
+ UpModalRemisionesNC.Update()
+
+ End Sub
+ Protected Sub GvDescNCCargos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCCargos.RowDataBound
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
+ e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
+ End If
+ End Sub
+ Protected Sub GvDescNCBonificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonificaciones.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
@@ -22556,11 +23065,11 @@ Partial Class Ventas
End If
ObjVentas.Dispose()
- AplicarNC(DdlNCPS.SelectedValue.ToEntero(), EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales, AplicaNuevoDocumento:=AplicaNuevoDocumento)
+ AplicarNC(DdlNCPS.SelectedValue.ToEntero(), EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales, AplicaNuevoDocumento:=AplicaNuevoDocumento, AplicoNCFacturaActual:=True)
End Sub
- Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False)
+ Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False)
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)
@@ -22585,6 +23094,8 @@ Partial Class Ventas
End If
End If
+ Me.AplicoNCFacturaActual = AplicoNCFacturaActual
+
'CREAMOS DT PARA UTILIZAR AL TIMBRAR
InicializaDTVentasNC()
@@ -22603,12 +23114,21 @@ Partial Class Ventas
DtImpuestos.AcceptChanges()
Dim AcumuladoNC As Decimal = 0
+ Dim DtImpuestosBonificacion As DataTable = DtImpuestos.Copy()
+
If Not AplicaNuevoDocumento Then
If AplicaNCMasiva Then
If NCDescuento Then
For Each RNC In ListaNCDesc
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
Next
+
+ 'SI HAY RNC DE BONIFICACION SE AGREGAN
+ If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
+ For Each RNC In ListaNCBonificacion
+ DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
+ Next
+ End If
Else
For Each Gvr As GridViewRow In GvCxC.Rows
@@ -22640,16 +23160,19 @@ Partial Class Ventas
End If
Else
For Each RNC In ListaRemisionesNC
- DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
+ DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
+ Next
+ For Each RNC In ListaNCBonificacion
+ DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
Next
End If
Dim query = From dr In DtImpuestos
Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal,
- PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
- PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
- PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
+ PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
+ PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
+ PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
Into x = Group
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
@@ -22661,9 +23184,25 @@ Partial Class Ventas
PorcentajeRetIVA = PorcentajeRetIVA,
PorcentajeRetISR = PorcentajeRetISR,
PorcentajeIEPS = PorcentajeIEPS
- '(1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
- 'Dim DrSubProyecto = GlobalDTSubProyectos(-1, TmpDT.FiltroPrimeroValor("CveSubProyecto", "", "ImporteTotal DESC").ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("")
+
+ Dim queryBonificacion = From dr In DtImpuestosBonificacion
+ Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal,
+ PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
+ PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
+ PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
+ Into x = Group
+ Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
+ ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
+ ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
+ ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
+ ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
+ ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
+ PorcentajeIVA = PorcentajeIVA,
+ PorcentajeRetIVA = PorcentajeRetIVA,
+ PorcentajeRetISR = PorcentajeRetISR,
+ PorcentajeIEPS = PorcentajeIEPS
+
Dim DrSubProyecto = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("")
@@ -22673,6 +23212,7 @@ Partial Class Ventas
End If
DtImpuestos = query.QueryToDataTable(False)
+ DtImpuestosBonificacion = queryBonificacion.QueryToDataTable(False)
If Not NCDescuento Then
LimpiaDocumentoNC()
@@ -22689,13 +23229,20 @@ Partial Class Ventas
TmpDTDescNC = TmpDT.Clone()
TmpDTDescNC.Clear()
- For Each Dr As DataRow In DtImpuestos.Rows
- AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
- DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
- TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal,
- Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString().ToDecimal, "", "", -1, -1,
- DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
- Next
+ If UsuarioActual.CveEmpresa = 140 Then
+
+ CrearDTNCCargo(ListaNCDesc, DtImpuestos, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
+ CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
+
+ Else
+ For Each Dr As DataRow In DtImpuestos.Rows
+ AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
+ DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
+ TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal,
+ Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString().ToDecimal, "", "", -1, -1,
+ DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
+ Next
+ End If
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("1")
@@ -22713,21 +23260,32 @@ Partial Class Ventas
Dim UltimoRenglon As Integer = 1
Dim Ajuste As Decimal = 0
- For Each Dr As DataRow In DtImpuestos.Rows
- Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal
- If UltimoRenglon = DtImpuestos.Rows.Count Then
- 'ajusta 5 centavos de diferencia
- If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then
- Ajuste = (Acumulado12 - AcumuladoNC)
+ 'DEBE AGREGAR LOS USADOS DE LA REMISION EN LA NOTA DE CREDITO
+ If UsuarioActual.CveEmpresa = 140 AndAlso ListaRemisionesNC.Count > 0 Then
+
+ CrearDTNCCargo(ListaRemisionesNC, DtImpuestos, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
+ CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
+
+ Else
+ For Each Dr As DataRow In DtImpuestos.Rows
+ Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal
+ If UltimoRenglon = DtImpuestos.Rows.Count Then
+ 'ajusta 5 centavos de diferencia
+ If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then
+ Ajuste = (Acumulado12 - AcumuladoNC)
+ End If
End If
- End If
- UltimoRenglon += 1
- AgregaTempDT(TmpDT, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
- DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
- TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal,
- Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString().ToDecimal(), "", "", -1, -1,
- DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
- Next
+ UltimoRenglon += 1
+
+ AgregaTempDT(TmpDT, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
+ DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
+ TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal,
+ Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString().ToDecimal(), "", "", -1, -1,
+ DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
+
+ Next
+ End If
+
GvPS.DataSource = TmpDT
GvPS.DataBind()
@@ -22756,7 +23314,87 @@ Partial Class Ventas
End If
End Sub
- Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional NivelTotal As Integer = 1) As DataTable
+ Private Sub CrearDTNCCargo(ListaNC As List(Of Modelos.Factura), DtImpuestos As DataTable, ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
+ For Each Dr As DataRow In DtImpuestos.Rows
+ For Each RNC In ListaNC
+ Dim UltimoRenglonRNC As Integer = 1
+ For Each RowUsado As DataRow In RNC.DtDetalle.Rows
+
+ Dim PorcentajeUsado = (RowUsado("Total").ToString().ToDecimal() - RowUsado("Descuento").ToString().ToDecimal() + RowUsado("ImporteIVA").ToString().ToDecimal() + RowUsado("ImporteIEPS").ToString().ToDecimal() - RowUsado("ImporteRetIVA").ToString().ToDecimal() - RowUsado("ImporteRetISR").ToString().ToDecimal()) / RNC.Total
+ Dim Obs = RowUsado("CodigoPS").ToString()
+
+ If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
+ Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
+ End If
+
+ Dim ImportePU = Dr("ImportePU").ToString().ToDecimal * PorcentajeUsado
+ Dim ImporteIVA = Dr("ImporteIVA").ToString().ToDecimal * PorcentajeUsado
+ Dim ImporteRetIVA = Dr("ImporteRetIVA").ToString().ToDecimal * PorcentajeUsado
+ Dim ImporteRetISR = Dr("ImporteRetISR").ToString().ToDecimal * PorcentajeUsado
+ Dim ImporteIEPS = Dr("ImporteIEPS").ToString().ToDecimal * PorcentajeUsado
+ Dim ImporteTotal = Dr("ImporteTotal").ToString().ToDecimal * PorcentajeUsado
+
+ 'If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count Then
+ ' ImportePU += Ajuste
+ 'End If
+
+ AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
+ DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
+ Obs, 1, ImportePU, Dr("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, Dr("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
+ Dr("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, Dr("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
+ DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
+
+ UltimoRenglonRNC += 1
+ Next
+
+ Next
+ Next
+ End Sub
+ Private Sub CrearDTNCBonificacion(ListaNC As List(Of Modelos.Factura), DtImpuestosBonificacion As DataTable, ByRef TmpDTNC As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
+ 'SI TIENE DE BONIFICACION LOS AGREGA
+ If DtImpuestosBonificacion IsNot Nothing AndAlso ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
+
+ TmpDTDescNCBonificacion = TmpDTNC.Clone()
+ TmpDTDescNCBonificacion.Clear()
+
+ For Each Dr As DataRow In DtImpuestosBonificacion.Rows
+ For Each RNC In ListaNCBonificacion
+ Dim UltimoRenglonRNC As Integer = 1
+
+ Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNC.CveVentaRNCCargo).FirstOrDefault()
+
+ For Each RowCargo As DataRow In RNCCargo.DtDetalle.Rows
+
+ Dim PorcentajeCargo = (RowCargo("Total").ToString().ToDecimal() - RowCargo("Descuento").ToString().ToDecimal() + RowCargo("ImporteIVA").ToString().ToDecimal() + RowCargo("ImporteIEPS").ToString().ToDecimal() - RowCargo("ImporteRetIVA").ToString().ToDecimal() - RowCargo("ImporteRetISR").ToString().ToDecimal()) / RNCCargo.Total
+
+ Dim Obs = RowCargo("CodigoPS").ToString()
+
+ If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
+ Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
+ End If
+
+ Dim ImportePU = Dr("ImportePU").ToString().ToDecimal * PorcentajeCargo
+ Dim ImporteIVA = Dr("ImporteIVA").ToString().ToDecimal * PorcentajeCargo
+ Dim ImporteRetIVA = Dr("ImporteRetIVA").ToString().ToDecimal * PorcentajeCargo
+ Dim ImporteRetISR = Dr("ImporteRetISR").ToString().ToDecimal * PorcentajeCargo
+ Dim ImporteIEPS = Dr("ImporteIEPS").ToString().ToDecimal * PorcentajeCargo
+ Dim ImporteTotal = Dr("ImporteTotal").ToString().ToDecimal * PorcentajeCargo
+
+ AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
+ DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
+ Obs, 1, ImportePU, Dr("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, Dr("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
+ Dr("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, Dr("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
+ DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
+
+ UltimoRenglonRNC += 1
+ Next
+
+ Next
+ Next
+ End If
+ End Sub
+
+ Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional NivelTotal As Integer = 1, Optional AplicaNCUsado As Boolean = False) As DataTable
Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0
Dim TmpDT As DataTable = Nothing
@@ -22776,7 +23414,7 @@ Partial Class Ventas
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
End If
- If AplicaNCMasiva Then
+ If AplicaNCMasiva OrElse AplicaNCUsado Then
If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
Total = ObjVentas.DtResultados()(0)("Total").ToString().ToDecimal
@@ -22822,8 +23460,10 @@ Partial Class Ventas
Dr("ImporteTotal") = importePuTemp.RoundSQL(2)
+ Dim TotalCalculableImpuestosIVA As Decimal = importePuTemp * (1 + Dr("PorcentajeIEPS").ToString().ToDecimal)
+
Dr("ImporteIEPS") = (importePuTemp * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
- Dr("ImporteIVA") = ((importePuTemp + Dr("ImporteIEPS").ToString().ToDecimal) * Dr("PorcentajeIVA").ToString().ToDecimal)
+ Dr("ImporteIVA") = ((TotalCalculableImpuestosIVA) * Dr("PorcentajeIVA").ToString().ToDecimal)
Dr("ImporteRetIVA") = (importePuTemp * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetISR") = (importePuTemp * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
@@ -22843,55 +23483,12 @@ Partial Class Ventas
'codigo para ajuste de centavo, si el importe total no cuadra con los totales
Dim difTmp As Decimal = Importe - importeNC
- 'el ajuste procede si no tiene iva,ni ieps, con iva sin ieps,
If Math.Abs(difTmp) > 0.00D Then
- 'filtro si hay renglon sin impuestos.
- Dim drDIF As DataRow() = DtImpuestosLocal.Select("ImporteIVA = 0 AND ImporteIEPS = 0")
-
- If drDIF IsNot Nothing AndAlso drDIF.Length > 0 Then
- Dim ImporteAjustado0 As Decimal = drDIF(0)("ImporteTotal").ToString().ToDecimal + difTmp
- drDIF(0)("ImporteTotal") = ImporteAjustado0
- drDIF(0)("ImportePU") = ImporteAjustado0
- Else
- 'filtro si hay renglon sin impuestos.
- Dim drDIF2 As DataRow() = DtImpuestosLocal.Select("ImporteIVA > 0 AND ImporteIEPS = 0")
-
- If drDIF2 IsNot Nothing AndAlso drDIF2.Length > 0 Then
- Dim PorIVA As Decimal = drDIF2(0)("PorcentajeIVA").ToString().ToDecimal
- Dim ImporteAjustado1 As Decimal = drDIF2(0)("ImporteTotal").ToString().ToDecimal + (difTmp / (1 + PorIVA)) 'saco el PU sin iva
- drDIF2(0)("ImportePU") = ImporteAjustado1
- drDIF2(0)("ImporteTotal") = ImporteAjustado1
- drDIF2(0)("ImporteIVA") = (ImporteAjustado1) * drDIF2(0)("PorcentajeIVA").ToString().ToDecimal
- Else
- ' ajustar cuando tiene ieps y no iva
- Dim drDIF3 As DataRow() = DtImpuestosLocal.Select("ImporteIVA = 0 AND ImporteIEPS > 0")
-
- If drDIF3 IsNot Nothing AndAlso drDIF3.Length > 0 Then
- Dim PorIEPS As Decimal = drDIF3(0)("PorcentajeIEPS").ToString().ToDecimal
- Dim ImporteAjustado1 As Decimal = drDIF3(0)("ImporteTotal").ToString().ToDecimal + (difTmp / (1 + PorIEPS)) 'saco el PU sin iva
- drDIF3(0)("ImportePU") = ImporteAjustado1
- drDIF3(0)("ImporteTotal") = ImporteAjustado1
- drDIF3(0)("ImporteIEPS") = (ImporteAjustado1) * drDIF3(0)("PorcentajeIEPS").ToString().ToDecimal
- Else
- ' ajustar cuando tiene ieps e iva
- Dim drDIF4 As DataRow() = DtImpuestosLocal.Select("ImporteIVA > 0 AND ImporteIEPS > 0")
-
- If drDIF4 IsNot Nothing AndAlso drDIF4.Length > 0 Then
- Dim PorIEPS As Decimal = drDIF4(0)("PorcentajeIEPS").ToString().ToDecimal
- Dim PorIVA As Decimal = drDIF4(0)("PorcentajeIVA").ToString().ToDecimal
- Dim ImporteAntesIVA As Decimal = (difTmp / (1 + PorIVA))
- Dim ImporteAjustado1 As Decimal = drDIF4(0)("ImporteTotal").ToString().ToDecimal + +(ImporteAntesIVA / (1 + PorIEPS)) 'saco el PU sin iva
- drDIF4(0)("ImportePU") = ImporteAjustado1
- drDIF4(0)("ImporteTotal") = ImporteAjustado1
- drDIF4(0)("ImporteIEPS") = (ImporteAjustado1) * drDIF4(0)("PorcentajeIEPS").ToString().ToDecimal
- drDIF4(0)("ImporteIVA") = (ImporteAjustado1 + drDIF4(0)("ImporteIEPS").ToString.ToDecimal) * drDIF4(0)("PorcentajeIVA").ToString().ToDecimal
- End If
- End If
- End If
-
- End If
-
+ 'asusto la diferencia en el último concepto
+ Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString().ToDecimal + Math.Abs(difTmp)
+ DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal") = ImporteAjustado
+ DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImportePU") = ImporteAjustado
End If
If Not NCDescuento Then
@@ -24482,11 +25079,9 @@ Partial Class Ventas
If dtSeleccionadas.Rows.Count > 0 Then
Select Case RblTipo.SelectedValue
Case "1" 'T O T A L G E N E R A L
-
For Each row As DataRow In dtSeleccionadas.Rows
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
Next
-
IsTotalxConcepto = False
Dim PU As Decimal = dtSeleccionadas.SUM("SubTotal").ToDecimal
Dim PS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa)(0)
@@ -24497,12 +25092,11 @@ Partial Class Ventas
PS("Clasificacion").ToString(), PS("CvePS").ToString().ToEntero(), PS("PS").ToString(), "", PU, 0,
rowSP("CveProyecto").ToString().ToEntero(), rowSP("Proyecto").ToString(), rowSP("CveSubProyecto").ToString().ToEntero(), rowSP("SubProyecto").ToString(), RegeneraIEPS:=True)
+ CalculaTotalesVenta()
Case "2" 'T O T A L X R E M I S I O N
-
For Each row As DataRow In dtSeleccionadas.Rows
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
Next
-
Dim PS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa)(0)
Dim rowSP As DataRow = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)(0)
Dim IVA As Double = If(dtSeleccionadas.SUM("Iva") > 0, dtSeleccionadas.SUM("Iva") / dtSeleccionadas.SUM("SubTotal"), 0.16)
@@ -24514,8 +25108,8 @@ Partial Class Ventas
End If
Next
+ CalculaTotalesVenta()
Case "3" 'T O T A L X C O N C E P T O
-
IsTotalxConcepto = True
Dim sb As New StringBuilder
If ChkRemProductos.Checked Then
@@ -24531,9 +25125,7 @@ Partial Class Ventas
RemisionesLista.Add(row("CveVenta").ToString().ToEntero())
Next
End If
-
sb.Remove(sb.Length - 1, 1)
-
CargaConceptosRemisionPorFacturar(sb.ToString(), If(ChkRemProductos.Checked, 2, 1))
sb.Clear()
End Select
@@ -25112,6 +25704,7 @@ Partial Class Ventas
BtnEditarCotizacion.Visible = False
BtnGenerarOS.Visible = False
BtnsFacturar.Visible = False
+ LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
HLOrdendeCompra.Visible = False
LBAplicaDevolucion.Visible = False
'LkNotaCredito.Visible = False
@@ -25645,7 +26238,7 @@ Partial Class Ventas
AgregarProductoServicio(drowPsTamaños("Cantidad").ToString().ToEntero(), drowPsTamaños("CveUnidadMedida").ToString().ToEntero(), drowPsTamaños("UnidadMedida").ToString(),
drowPsTamaños("CveClasificacion").ToString().ToEntero(), drowPsTamaños("Clasificacion").ToString(), drowPsTamaños("CvePS").ToString().ToEntero(),
drowPsTamaños("PS").ToString(), "", drowPsTamaños("PU").ToString().ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString().ToEntero(),
- drowPsTamaños("SubProyecto").ToString(), CveVentaDetalle:=CveVentaDetalleDevolucion)
+ drowPsTamaños("SubProyecto").ToString(), CveVentaDetalle:=CveVentaDetalleDevolucion, EsCargo:=True)
End If
Next
@@ -25729,6 +26322,12 @@ Partial Class Ventas
ListaRemisionesNC.Clear()
End If
+ If ListaNCBonificacion Is Nothing Then
+ ListaNCBonificacion = New List(Of Modelos.Factura)
+ Else
+ ListaNCBonificacion.Clear()
+ End If
+
Dim TotalRemNCAplicado As Decimal = 0
For Each GvRow As GridViewRow In GvRemisionesNC.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
@@ -25748,6 +26347,25 @@ Partial Class Ventas
End If
Next
+ For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows
+ If GvRow.RowType = DataControlRowType.DataRow Then
+ If GvRow.FCCheckBox("ChkAplicar").Checked Then
+ Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
+ RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
+ RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
+ TotalRemNCAplicado += RemNC.TotalRemNCAplicado
+
+ If RemNC.TotalRemNCAplicado <= 0 Then
+ Alert($"Debe asignar un importe en la siguiente remisión: {RemNC.SerieFolio}", TipoMensaje.MsgAdvertencia)
+ ListaNCBonificacion.Clear()
+ Exit Sub
+ End If
+
+ ListaNCBonificacion.Add(RemNC)
+ End If
+ End If
+ Next
+
TxtImportesRemisionesNC.Text = TotalRemNCAplicado.FormatoNumero
TxtNCImporte.Text = TotalRemNCAplicado.FormatoNumero
@@ -25778,8 +26396,14 @@ Partial Class Ventas
ListaNCDesc.Clear()
End If
+ If ListaNCBonificacion Is Nothing Then
+ ListaNCBonificacion = New List(Of Modelos.Factura)
+ Else
+ ListaNCBonificacion.Clear()
+ End If
+
Dim TotalRemNCAplicado As Decimal = 0
- For Each GvRow As GridViewRow In GvDescNC.Rows
+ For Each GvRow As GridViewRow In GvDescNCCargos.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
@@ -25797,6 +26421,34 @@ Partial Class Ventas
End If
Next
+ Dim LimiteUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal()
+
+ 'VERIFICA EL LIMITE DE LOS USADOS
+ If TotalRemNCAplicado > LimiteUsados Then
+ Alert($"La suma de las remisiones de nota de crédito de tipo 'Cargo' no debe superar el total de Usados. Total RNC: {TotalRemNCAplicado:N2}. Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
+ ListaNCDesc.Clear()
+ Exit Sub
+ End If
+
+ For Each GvRow As GridViewRow In GvDescNCBonificaciones.Rows
+ If GvRow.RowType = DataControlRowType.DataRow Then
+ If GvRow.FCCheckBox("ChkAplicar").Checked Then
+ Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
+ RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
+ RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
+ TotalRemNCAplicado += RemNC.TotalRemNCAplicado
+
+ If RemNC.TotalRemNCAplicado <= 0 Then
+ Alert($"Debe asignar un importe en la siguiente remisión: {RemNC.SerieFolio}", TipoMensaje.MsgAdvertencia)
+ ListaNCBonificacion.Clear()
+ Exit Sub
+ End If
+
+ ListaNCBonificacion.Add(RemNC)
+ End If
+ End If
+ Next
+
LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero
LblTotalNC.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado).FormatoNumero
@@ -25834,6 +26486,33 @@ Partial Class Ventas
End If
End Sub
+
+ Protected Sub PreparaNCBonificacion(ByRef factura As Modelos.Factura)
+ If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
+ factura.DtDetalle = Me.TmpDTDescNCBonificacion
+ '**** IMPUESTOS LOCALES
+
+ Dim TotalSubTotal As Decimal = TmpDTDescNCBonificacion.SUM("TotalImporte").ToDecimal
+ Dim TotalDescuentos As Decimal = TmpDTDescNCBonificacion.SUM("Descuento").ToDecimal
+
+ Dim TotalIVA As Decimal = TmpDTDescNCBonificacion.SUM("ImporteIVA").ToDecimal
+ Dim TotalIEPS As Decimal = TmpDTDescNCBonificacion.SUM("ImporteIEPS").ToDecimal
+ Dim TotalRetIVA As Decimal = TmpDTDescNCBonificacion.SUM("ImporteRetIVA").ToDecimal
+ Dim TotalRetISR As Decimal = TmpDTDescNCBonificacion.SUM("ImporteRetISR").ToDecimal
+ Dim Total As Decimal = 0
+ Dim TotalImpuestosLocales As Decimal = 0
+ Total = (TotalSubTotal - TotalDescuentos + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
+
+ factura.SubTotal = TotalSubTotal
+ factura.Descuento = TotalDescuentos
+ factura.IVA = TotalIVA
+ factura.IEPS = TotalIEPS
+ factura.RetIVA = TotalRetIVA
+ factura.RetISR = TotalRetISR
+ factura.Total = Total
+
+ End If
+ End Sub
#End Region
Protected Sub BtnModalAplicarRemisionesNC_Click(sender As Object, e As EventArgs)
@@ -26249,6 +26928,15 @@ Partial Class Ventas
ObjVentas.Dispose()
End Sub
+ Private Sub DeshabilitarAplicarNotaDeCredito(RFC As String)
+
+ If UsuarioActual.CveEmpresa = 119 AndAlso RFC.Contiene("XAXX010101000", "XEXX010101000") Then
+ LBNotaCredito.Visible = False
+ UpnTools.Update()
+ End If
+
+ End Sub
+
#Region "Auxiliar"
Private Sub CargarSaldoAuxiliar(CveCliente As Integer)
@@ -26367,4 +27055,5 @@ Partial Class Ventas
End Sub
#End Region
+
End Class
\ No newline at end of file