This commit is contained in:
Antonio Gonzalez
2020-02-20 10:44:00 -07:00
23 changed files with 1898 additions and 642 deletions

View File

@@ -1858,7 +1858,7 @@ Public Class ClsCompProveedores
Return Retorno Return Retorno
End Function End Function
Public Function GetRePresentanteLegal(CveRepresentanteLegal As Integer, CveEmpresa As Integer) As Boolean Public Function GetRePresentanteLegal(CveRepresentanteLegal As Integer, CveEmpresa As Integer, Optional CveProveedor As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
@@ -1868,6 +1868,7 @@ Public Class ClsCompProveedores
.Add("@CveRepresentanteLegal", SqlDbType.Int).Value = CveRepresentanteLegal .Add("@CveRepresentanteLegal", SqlDbType.Int).Value = CveRepresentanteLegal
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
End With End With

View File

@@ -1074,7 +1074,7 @@ Public Class ClsContPAQi
StrSQL.AppendLine(" INNER JOIN Polizas p ON mp.IdPoliza = p.Id ") StrSQL.AppendLine(" INNER JOIN Polizas p ON mp.IdPoliza = p.Id ")
StrSQL.AppendLine(" INNER JOIN Cuentas c ON c.Id = mp.IdCuenta ") StrSQL.AppendLine(" INNER JOIN Cuentas c ON c.Id = mp.IdCuenta ")
StrSQL.AppendLine(" INNER JOIN TiposPolizas t ON mp.TipoPol = t.Codigo ") StrSQL.AppendLine(" INNER JOIN TiposPolizas t ON mp.TipoPol = t.Codigo ")
StrSQL.AppendLine(" LEFT JOIN SIG_Resp_OIC.dbo.Usuarios U ON U.CveUsuario = P.IdUsuario ") StrSQL.AppendLine(" LEFT JOIN SERVIDOR.Ventas.dbo.Usuarios U ON U.CveUsuario = P.IdUsuario ")
StrSQL.AppendLine(" LEFT JOIN SegmentosNegocio s ON mp.IdSegNeg = s.id ") StrSQL.AppendLine(" LEFT JOIN SegmentosNegocio s ON mp.IdSegNeg = s.id ")
StrSQL.AppendLine(" WHERE (@IdPoliza = -1 OR mp.IdPoliza = @IdPoliza) ") StrSQL.AppendLine(" WHERE (@IdPoliza = -1 OR mp.IdPoliza = @IdPoliza) ")
StrSQL.AppendLine(" AND (@Eje = -1 OR mp.Ejercicio = @Eje) ") StrSQL.AppendLine(" AND (@Eje = -1 OR mp.Ejercicio = @Eje) ")

View File

@@ -14,6 +14,7 @@ Imports System.Net
Imports System.IO.Compression Imports System.IO.Compression
Imports System.Text Imports System.Text
Imports System.Net.Http Imports System.Net.Http
Imports System.Collections.Generic
Namespace Modelos Namespace Modelos
@@ -539,7 +540,64 @@ Namespace Modelos
Public Property CveEstatus As Integer Public Property CveEstatus As Integer
End Class End Class
Public Function RegenerarPrePolizas(Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing, Optional ObjACTransac As ClsContPAQi = Nothing) As Boolean
Dim ErrorPrePolizas As Boolean = False
Dim ObjVentas As ClsVentas = Nothing
If TransaccionCompartida IsNot Nothing Then
ObjVentas = New ClsVentas(TransaccionCompartida)
Else
ObjVentas = New ClsVentas()
ObjVentas.IniciaTransacSQL()
End If
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL())
Dim ObjAC As ClsContPAQi = Nothing
If ObjACTransac Is Nothing Then
If UsuarioActual.Empresa.UsaAC Then
ObjAC = New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
End If
Else
ObjAC = ObjACTransac
End If
ErrorPrePolizas = Not RegeneracionPolizas(Me, ObjVentas, ObjAC, ObjConta, ObjBancos, ObjEventos)
If TransaccionCompartida Is Nothing Then
ObjVentas.Commit()
ObjVentas.Dispose()
ObjBancos.Dispose()
ObjEventos.Dispose()
End If
If ObjACTransac Is Nothing Then
If ObjAC IsNot Nothing Then
ObjAC.Commit()
ObjAC.Dispose()
End If
End If
Return Not ErrorPrePolizas
End Function
Private Function RegeneracionPolizas(ObjFactura As Modelos.Factura, ByRef ObjVentas As ClsVentas, ByRef ObjAC As ClsContPAQi, ByRef ObjConta As ClsContabilidad, ObjBancos As ClsBancos, ObjEventos As ClsOIEventos) As Boolean
Dim ErrorPrePolizas As Boolean = False
'REMOVEMOS LOS CONCEPTOS DE LA PREPOLIZA
ErrorPrePolizas = Not ObjConta.RemovePrePolizasDetalle(ObjFactura.CvePrePoliza, -1, ObjFactura.CveVenta, 2)
'VUELVE A GENERAR LAS PREPOLIZAS
If Not ErrorPrePolizas Then
ErrorPrePolizas = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, ObjAC, ValorMultiplicador:=1, ObjBancos:=ObjBancos, ObjVentas:=ObjVentas, ObjEventos:=ObjEventos, DtRemisionesRelacionadas:=New DataTable, SeCancelaRemisionProceso:=False,
CancelarRemisiones:=False, ListaRemisionesCancelar:=New List(Of Integer))
End If
If Not ErrorPrePolizas Then ErrorPrePolizas = GuardarVentaImpuestosLocales(ObjFactura, ObjVentas, ObjConta, 1)
Return Not ErrorPrePolizas
End Function
Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Transac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing) As MMensajeFactura Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Transac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing) As MMensajeFactura
Dim Retorno As New MMensajeFactura() Dim Retorno As New MMensajeFactura()
@@ -1059,7 +1117,7 @@ Namespace Modelos
Return Retorno Return Retorno
End Function End Function
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = true) As Byte() Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte()
Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
Dim File As Byte() = Nothing Dim File As Byte() = Nothing
Try Try

View File

@@ -617,8 +617,8 @@ Partial Class Bancos_PopIECompras
MovimientoPagar = New IEMovimiento MovimientoPagar = New IEMovimiento
MovimientoPagar.SubTotal = dr("SubTotal").ToString.ToDecimal MovimientoPagar.SubTotal = dr("SubTotal").ToString.ToDecimal
MovimientoPagar.IVA = dr("IVA").ToString.ToDecimal MovimientoPagar.IVA = dr("IVA").ToString.ToDecimal
MovimientoPagar.IVADeducible = dr("IVADeducible").ToString.ToDecimal MovimientoPagar.IVADeducible = dr("IVADeducible").ToString.ToDecimal.RoundSQL
MovimientoPagar.IVANoDeducible = dr("IVANoDeducible").ToString.ToDecimal MovimientoPagar.IVANoDeducible = dr("IVANoDeducible").ToString.ToDecimal.RoundSQL
MovimientoPagar.RetIVA = dr("RetIVA").ToString.ToDecimal MovimientoPagar.RetIVA = dr("RetIVA").ToString.ToDecimal
MovimientoPagar.RetISR = dr("RetISR").ToString.ToDecimal MovimientoPagar.RetISR = dr("RetISR").ToString.ToDecimal
MovimientoPagar.Total = dr("Total").ToString.ToDecimal MovimientoPagar.Total = dr("Total").ToString.ToDecimal
@@ -1982,6 +1982,75 @@ Partial Class Bancos_PopIECompras
End If End If
End If End If
End If End If
Case 285 'Ret IVA x Acreditar Acreditable Servicios
If MovimientoPagar.ConceptoRetIVA = 5 Then
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
ImporteMovimiento = MovimientoPagar.RetIVA * PorcentajePago
ImporteMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago)
ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago)
ImporteMX = ImporteMovimiento * tipoCambioCompra
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago)
ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
End If
ImporteMovimiento = Math.Round(ImporteMovimiento, 2)
ImporteMX = Math.Round(ImporteMX, 2)
TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
'Conta ContPAQ
If IdCtaContRetIVA > 0 Then
IdCtaContable = IdCtaContRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(578).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero
Else
If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
Case 286 'Ret IVA Acreditable Servicio
If MovimientoPagar.ConceptoRetIVA = 5 Then
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
ImporteMovimiento = MovimientoPagar.RetIVA * PorcentajePago
ImporteMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago)
ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago)
ImporteMX = ImporteMovimiento * tipoCambioCompra
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago)
ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
End If
ImporteMovimiento = Math.Round(ImporteMovimiento, 2)
ImporteMX = Math.Round(ImporteMX, 2)
TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
'Conta ContPAQ
If IdCtaContRetIVAAcreditable > 0 Then
IdCtaContable = IdCtaContRetIVAAcreditable
ElseIf UsuarioActual.Empresa.Funcionalidad(582).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(582).ToEntero
Else
If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
'Case 16 'Ret ISR X Acreditar 'Case 16 'Ret ISR X Acreditar
' If MovimientoPagar.ConceptoRetISR = 1 Then ' If MovimientoPagar.ConceptoRetISR = 1 Then
' If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then ' If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
@@ -2280,7 +2349,7 @@ Partial Class Bancos_PopIECompras
Else Else
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
ImporteMovimiento = MovimientoPagar.IVADeducible * PorcentajePago ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago).RoundSQL
ImporteMX = ImporteMovimiento ImporteMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago) ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago)
@@ -2579,8 +2648,8 @@ Partial Class Bancos_PopIECompras
End If End If
ObjCreditos.Dispose() ObjCreditos.Dispose()
Else Else
IdCtaContable = CtaProveedor IdCtaContable = IdCuentaBancaria
CveCuenta = CveCuentaProveedor CveCuenta = CveCuentaCliente
End If End If
Else Else
IdCtaContable = IdCtaContComplementaria IdCtaContable = IdCtaContComplementaria
@@ -2675,6 +2744,8 @@ Partial Class Bancos_PopIECompras
ImporteMovimiento = Math.Round(ImporteMovimiento, 2) ImporteMovimiento = Math.Round(ImporteMovimiento, 2)
ImporteMX = Math.Round(ImporteMX, 2) ImporteMX = Math.Round(ImporteMX, 2)
TimpocambioGeneral = tipoCambioPago TimpocambioGeneral = tipoCambioPago
IdCtaContable = GlobalDTRHPersonal(UsuarioActual.CveEmpresa, CvePersonal:=CvePersonal).FiltroPrimeroValor("IdCtaContPersonal", "").ToEntero
Else Else
ImporteMovimiento = 0 ImporteMovimiento = 0
End If End If
@@ -3146,7 +3217,7 @@ Partial Class Bancos_PopIECompras
If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 5) Then
If ObjMov.ValorPolizaDescuadre > 0 Then If ObjMov.ValorPolizaDescuadre > 0 Then
'MsgError = ObjMov.MensajePolizaDescuadre MsgError = ObjMov.MensajePolizaDescuadre
GuardaLogAD($"Bancos/PopIECompras | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") GuardaLogAD($"Bancos/PopIECompras | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
End If End If
End If End If

View File

@@ -1261,6 +1261,72 @@ Partial Class Bancos_ProveedoresAbonar
End If End If
End If End If
End If End If
Case 285 'Ret IVA x Acreditar Acreditable Servicios
If gvr.DataKey("CveRetIVAConcepto").ToEntero = 5 Then
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * tipoCambioCompra
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
End If
ImporteMovimiento = Math.Round(ImporteMovimiento, 2)
importeMX = Math.Round(importeMX, 2)
If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
'Conta ContPAQ
If IdCtaContRetIVA > 0 Then
IdCtaContable = IdCtaContRetIVA
ElseIf UsuarioActual.Empresa.Funcionalidad(578).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero
Else
If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
Case 286 'Ret IVA Acreditable Servicio
If gvr.DataKey("CveRetIVAConcepto").ToEntero = 5 Then
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = ImporteMovimiento
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * tipoCambioCompra
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago)
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
End If
ImporteMovimiento = Math.Round(ImporteMovimiento, 2)
importeMX = Math.Round(importeMX, 2)
If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
'Conta ContPAQ
If IdCtaContRetIVAAcreditable > 0 Then
IdCtaContable = IdCtaContRetIVAAcreditable
ElseIf UsuarioActual.Empresa.Funcionalidad(582).ToEntero > 0 Then
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(582).ToEntero
Else
If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then
If ObjMov.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
End If
'Case 16 'Ret ISR X Acreditar 'Case 16 'Ret ISR X Acreditar
' If gvr.DataKey("CveRetISRConcepto").ToEntero = 1 Then ' If gvr.DataKey("CveRetISRConcepto").ToEntero = 1 Then
' If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then ' If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then

View File

@@ -106,6 +106,15 @@ Partial Class Compras_Compras
End Set End Set
End Property End Property
Public Property TieneAnticiposXML As Boolean
Get
TieneAnticiposXML = DirectCast(ViewState("TieneAnticiposXML"), Boolean)
End Get
Set(ByVal value As Boolean)
ViewState("TieneAnticiposXML") = value
End Set
End Property
Private Property DTOCTemp As DataTable Private Property DTOCTemp As DataTable
Get Get
Return CType(ViewState("DTOCTemp"), DataTable) Return CType(ViewState("DTOCTemp"), DataTable)
@@ -873,6 +882,7 @@ Partial Class Compras_Compras
Private Property Descuentos As Decimal = 0 Private Property Descuentos As Decimal = 0
Private Property Amortizaciones As Decimal = 0
Private Property EmisorRFC As String Private Property EmisorRFC As String
Private Property ReceptorRFC As String Private Property ReceptorRFC As String
Private Property TrasladoIVA As Decimal = 0 Private Property TrasladoIVA As Decimal = 0
@@ -1116,6 +1126,7 @@ Partial Class Compras_Compras
'ImgBtnBuscarOC.Attributes.Add("data-toggle", "tooltip") 'ImgBtnBuscarOC.Attributes.Add("data-toggle", "tooltip")
'ImgBtnBuscarOC.Attributes.Add("data-placement", "top") 'ImgBtnBuscarOC.Attributes.Add("data-placement", "top")
CargaDatosAgregarPS() CargaDatosAgregarPS()
TieneAnticiposXML = False
Modalidad = "" Modalidad = ""
Version = "" Version = ""
CveMetodoPago = -1 CveMetodoPago = -1
@@ -1406,7 +1417,10 @@ Partial Class Compras_Compras
'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO
LblSaldoFactura.Text = If(CveCompra > 0, Saldo.FormatoNumero, TxtTotal.Text.FormatoNumero) LblSaldoFactura.Text = If(CveCompra > 0, Saldo.FormatoNumero, TxtTotal.Text.FormatoNumero)
'cuando es factura con amortizacion, el importe a descontar es el saldo que se debe de aplicar para la amortizacion
If ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 Then
LblSaldoFactura.Text = TmpDT.SUMD("Descuento").ToString
End If
If UsuarioActual.CveEmpresa = 126 And CveCompra > 0 Then If UsuarioActual.CveEmpresa = 126 And CveCompra > 0 Then
LnkExportaGv.Visible = True LnkExportaGv.Visible = True
@@ -1829,6 +1843,20 @@ Partial Class Compras_Compras
VerVales.Visible = True VerVales.Visible = True
End If End If
If TieneAnticiposXML Then 'si tiene anticipos, limpia los descuentos
'LblAmortizacion.Text = ImporteAnticipo.FormatoNumero
TxtDescuento.Text = "0.00"
LblAmortizacion.Text = Descuentos.FormatoNumero
'limpia los descuentos
For Each drr As DataRow In TmpDT.Rows
'drr("Total") = drr("Total").ToString.ToDecimal + drr("Descuento").ToString.ToDecimal
drr("Amortizacion") = drr("Descuento") 'pasamos el importe de descuento a amortizacion
drr("Descuento") = 0.00
Next
Amortizaciones = Descuentos
Descuentos = 0
End If
Dim Msg As String = "" Dim Msg As String = ""
@@ -2127,7 +2155,7 @@ Partial Class Compras_Compras
Private Sub ValidacionesTotalesXml() Private Sub ValidacionesTotalesXml()
Dim Msg As String = "" Dim Msg As String = ""
Dim SubtotalTemp = TmpDT.SUM("Total") + Math.Round(TmpDT.SUM("Descuento"), 2) Dim SubtotalTemp = TmpDT.SUM("Total") + Math.Round(TmpDT.SUM("Descuento") + Math.Round(TmpDT.SUM("Amortizacion")), 2)
Dim DescuentosTemp = TmpDT.SUM("Descuento") Dim DescuentosTemp = TmpDT.SUM("Descuento")
Dim Subtotal2Temp = TmpDT.SUM("Total") Dim Subtotal2Temp = TmpDT.SUM("Total")
Dim IVATemp = TmpDT.SUM("IVA") Dim IVATemp = TmpDT.SUM("IVA")
@@ -4369,7 +4397,7 @@ Partial Class Compras_Compras
'METODO DE PREPOLIZA DE ALMACEN 'METODO DE PREPOLIZA DE ALMACEN
If UsuarioActual.CveEmpresa.Contiene(1, 119, 72, 80) And UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then If UsuarioActual.CveEmpresa.Contiene(1, 119, 72, 80) And UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then
Dim ImporteAlmacen = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveTipoPS = 2").ToString.ToDecimal Dim ImporteAlmacen = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveTipoPS = 2").ToString.ToDecimal
If ImporteAlmacen > 0 Then If ImporteAlmacen > 0 Then
If Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then If Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then
If (CveImportacion > 0 Or CveFlete > 0) Then If (CveImportacion > 0 Or CveFlete > 0) Then
@@ -4403,10 +4431,17 @@ Partial Class Compras_Compras
End If End If
'hay amortización directa como descuento. RMF Temporal 'hay amortización directa como descuento. RMF Temporal
If UsuarioActual.CveEmpresa = 119 Then If UsuarioActual.CveEmpresa = 119 Then
If LblAmortizacion.Text.ToDouble > 0 AndAlso TxtDescuento.Text.ToDouble = 0 Then 'If LblAmortizacion.Text.ToDouble > 0 AndAlso TxtDescuento.Text.ToDouble = 0 Then
TxtDescuento.Text = LblAmortizacion.Text ' TxtDescuento.Text = LblAmortizacion.Text
LblAmortizacion.Text = "0.00" ' LblAmortizacion.Text = "0.00"
End If 'End If
'o si el descuento es igual a la amortizacion
'If LblAmortizacion.Text.ToDouble = TxtDescuento.Text.ToDouble Then
' TxtDescuento.Text = LblAmortizacion.Text
' LblAmortizacion.Text = "0.00"
'End If
End If End If
'Compra 'Compra
@@ -6175,17 +6210,16 @@ Partial Class Compras_Compras
Else Else
importeMovimiento = 0 importeMovimiento = 0
End If End If
Case 285 'Perdida Case 285 'Ret IVA 6% Servicios
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero
End If
End If
IdCtaContable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero
'If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
' If ObjConta.DtResultados.Rows.Count > 0 Then
' IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
' CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero
' End If
'End If
If DdlRetIVAConcepto.SelectedValue.ToEntero = 5 Then If DdlRetIVAConcepto.SelectedValue.ToEntero = 5 Then
@@ -6201,10 +6235,6 @@ Partial Class Compras_Compras
Else Else
importeMovimiento = 0 importeMovimiento = 0
End If End If
Case 6 'Compra Case 6 'Compra
Dim AgregaMercanciaInventario As Boolean = UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119) AndAlso UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Dim AgregaMercanciaInventario As Boolean = UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119) AndAlso UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1"
@@ -6784,6 +6814,7 @@ Partial Class Compras_Compras
Else Else
ErrorPrepoliza = True ErrorPrepoliza = True
Exit For Exit For
Exit For
End If End If
' FLUCTUACION CAMBIARIA ' FLUCTUACION CAMBIARIA
@@ -7014,7 +7045,7 @@ Partial Class Compras_Compras
Exit For Exit For
End If End If
If TxtTotal.Text.ToDouble > 0 Then If TxtTotal.Text.ToDouble > 0 AndAlso TieneAnticiposXML = False Then
importeMNNC = importeMovimientoNC * tipoCambioActual * Multiplicador importeMNNC = importeMovimientoNC * tipoCambioActual * Multiplicador
IdCtaContable = CtaProveedorExtranjera ' CtaProveedorAnticiposExtranjera IdCtaContable = CtaProveedorExtranjera ' CtaProveedorAnticiposExtranjera
CveCuenta = CveCuentaProveedorExtranjera 'CveCuentaProveedorAnticiposExtranjera CveCuenta = CveCuentaProveedorExtranjera 'CveCuentaProveedorAnticiposExtranjera
@@ -7116,7 +7147,7 @@ Partial Class Compras_Compras
ErrorPrepoliza = True ErrorPrepoliza = True
End If End If
If TxtTotal.Text.ToDouble > 0 Then If TxtTotal.Text.ToDouble > 0 AndAlso TieneAnticiposXML = False Then
Dim IdCtaContablePago As Integer = CtaProveedor Dim IdCtaContablePago As Integer = CtaProveedor
Dim CveCuentaPago As Integer = CveCuentaProveedor Dim CveCuentaPago As Integer = CveCuentaProveedor
Dim usacomplementariaProveedor As Boolean = False Dim usacomplementariaProveedor As Boolean = False
@@ -7177,6 +7208,8 @@ Partial Class Compras_Compras
Dim PorcentajePagoAnt As Decimal = importeMovimiento / If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDecimal) Dim PorcentajePagoAnt As Decimal = importeMovimiento / If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDecimal)
Dim ImporteIVA As Decimal = Math.Round(PorcentajePagoAnt * TxtIVA.Text.ToDecimal, 2) Dim ImporteIVA As Decimal = Math.Round(PorcentajePagoAnt * TxtIVA.Text.ToDecimal, 2)
If ImporteIVA <> 0 Then
'Agregamos el 14 'Agregamos el 14
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteIVA, Referencia, 14, Concepto, FechaMovimiento, CtaIvaxAcreditar, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveIE:=Ant.CveIE, CveColectiva:=CveColectiva, ImporteMX:=ImporteIVA * tipoCambioActual * Multiplicador, ImporteME:=If(tipoCambioActual = 1, 0, ImporteIVA), CveCuenta:=CveCuentaIvaxAcreditar, PorcentajeImpuesto:=PorcentajeImpuestoAnticipo, Contabilizable:=SeContabiliza) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteIVA, Referencia, 14, Concepto, FechaMovimiento, CtaIvaxAcreditar, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveIE:=Ant.CveIE, CveColectiva:=CveColectiva, ImporteMX:=ImporteIVA * tipoCambioActual * Multiplicador, ImporteME:=If(tipoCambioActual = 1, 0, ImporteIVA), CveCuenta:=CveCuentaIvaxAcreditar, PorcentajeImpuesto:=PorcentajeImpuestoAnticipo, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True ErrorPrepoliza = True
@@ -7188,6 +7221,8 @@ Partial Class Compras_Compras
End If End If
End If End If
End If
End If End If
@@ -7505,7 +7540,8 @@ Partial Class Compras_Compras
If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Ant.Importe, " ", CveConceptoAnt, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveIE:=Ant.CveIE, CveColectiva:=CveColectiva, ImporteMX:=Ant.Importe) Then If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Ant.Importe, " ", CveConceptoAnt, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveIE:=Ant.CveIE, CveColectiva:=CveColectiva, ImporteMX:=Ant.Importe) Then
' ImporteAnticipo += Ant.Importe ' RESTO DEL IMPORTE POR SI QUEDA DIFERENCIA DE LA SUMA DE LOS ANTICIPOS Y EL PROVEEDOR TIENE QUE PAGAR ' ImporteAnticipo += Ant.Importe ' RESTO DEL IMPORTE POR SI QUEDA DIFERENCIA DE LA SUMA DE LOS ANTICIPOS Y EL PROVEEDOR TIENE QUE PAGAR
'movimiento de pago proveedor, --no se regisra porque no se registra el total de la compra como deuda del proveedor, solo lo que queda a deber 'movimiento de pago proveedor, --no se regisra porque no se registra el total de la compra como deuda del proveedor, solo lo que queda a deber
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoCompra, Ant.Importe, " ", CveConceptoPago, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveIE:=Ant.CveIE, CveColectiva:=CveColectiva, ImporteMX:=Ant.Importe) Then 'si es l moviemiento es de amortizacion con descuento, no registra el pago, ya esta descontado
If TieneAnticiposXML = False AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoCompra, Ant.Importe, " ", CveConceptoPago, " ", TxtFechaPago.Text.ToDate, 0, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorLocal, CveAcreedor:=CveAcreedor, CveIE:=Ant.CveIE, CveColectiva:=CveColectiva, ImporteMX:=Ant.Importe) Then
ErrorMovtosCxP = True ErrorMovtosCxP = True
End If End If
PorcentajePago = (Ant.Importe) / TxtTotal.Text.ToDecimal PorcentajePago = (Ant.Importe) / TxtTotal.Text.ToDecimal
@@ -8132,8 +8168,10 @@ Partial Class Compras_Compras
'If gvr.DataKey("Fecha").ToDate > Fecha Then Fecha = gvr.DataKey("Fecha").ToDate 'guardo la fecha mayor 'If gvr.DataKey("Fecha").ToDate > Fecha Then Fecha = gvr.DataKey("Fecha").ToDate 'guardo la fecha mayor
Importe += gvr.FCTextBox("TxtAnticipo").Text.ToDouble Importe += gvr.FCTextBox("TxtAnticipo").Text.ToDouble
If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then gvr.FCTextBox("TxtAnticipo").Text = "" : gvr.FCCheckBox("Chk").Checked = False If Math.Round(Importe, 2) - Math.Round(CompraSaldo, 2) > 0.01 Then gvr.FCTextBox("TxtAnticipo").Text = "" : gvr.FCCheckBox("Chk").Checked = False
End If End If
Next Next
Else Else
Contador = 1 Contador = 1
End If End If
@@ -9068,6 +9106,7 @@ Partial Class Compras_Compras
End If End If
LblAmortizacion.Text = ImporteAnticipo.FormatoNumero LblAmortizacion.Text = ImporteAnticipo.FormatoNumero
UpPS.Update() UpPS.Update()
End If End If
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAnticipos")) RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAnticipos"))
@@ -10119,6 +10158,7 @@ Partial Class Compras_Compras
If documento.Attributes("UUID").Value <> "" Then If documento.Attributes("UUID").Value <> "" Then
ListaDocumentos.Add(documento.Attributes("UUID").Value) ListaDocumentos.Add(documento.Attributes("UUID").Value)
End If End If
TieneAnticiposXML = True
Next Next
End If End If
End If End If
@@ -10288,9 +10328,10 @@ Partial Class Compras_Compras
Else Else
If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(3).ForeColor = Drawing.Color.Red If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(3).ForeColor = Drawing.Color.Red
If e.Row.DBCampo("Saldo").ToDouble = 0 Then e.Row.FCLiteral("LtlAnticipos").Text = "" If e.Row.DBCampo("Saldo").ToDouble = 0 Then e.Row.FCLiteral("LtlAnticipos").Text = ""
Dim ImporteAmortizacion As Decimal = If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDecimal)
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2});", e.Row.FCTextBox("TxtAnticipo").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDouble)), e.Row.DBCampo("CveMoneda").ToEntero, If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble), DdlMoneda.SelectedValue.ToEntero)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2});", e.Row.FCTextBox("TxtAnticipo").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, ImporteAmortizacion), e.Row.DBCampo("CveMoneda").ToEntero, If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble), DdlMoneda.SelectedValue.ToEntero)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO
e.Row.FCTextBox("TxtAnticipo").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1},{2});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUMD("ImporteConImpuestos"), TxtTotal.Text.ToDouble)), e.Row.DBCampo("CveMoneda").ToEntero, If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble), DdlMoneda.SelectedValue.ToEntero)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO e.Row.FCTextBox("TxtAnticipo").Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1},{2});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), If(CveCompra > 0, Saldo, ImporteAmortizacion), e.Row.DBCampo("CveMoneda").ToEntero, If(Not e.Row.DBCampo("TCCompra").ToDouble > 1, GlobalTipoCambio(e.Row.DBCampo("Fecha").ToDate), e.Row.DBCampo("TCCompra").ToDouble), DdlMoneda.SelectedValue.ToEntero)) 'SI ES UNA COMPRA NUEVA SE PONE EL TOTAL, SI NO EL SALDO
If ChkNCInv.Checked Then If ChkNCInv.Checked Then
e.Row.FCCheckBox("Chk").CssClass = "ChkAntNC" e.Row.FCCheckBox("Chk").CssClass = "ChkAntNC"
@@ -10303,6 +10344,8 @@ Partial Class Compras_Compras
Entro = True Entro = True
End If End If
Next Next
'permite vincular otro folio fiscal.
Entro = True
If Not Entro Then e.Row.FCCheckBox("Chk").Enabled = False If Not Entro Then e.Row.FCCheckBox("Chk").Enabled = False
End If End If
End If End If
@@ -10614,6 +10657,7 @@ Partial Class Compras_Compras
DTConceptos.Columns.Add("Descuento", GetType(Double)) DTConceptos.Columns.Add("Descuento", GetType(Double))
DTConceptos.Columns.Add("IVA", GetType(Double)) DTConceptos.Columns.Add("IVA", GetType(Double))
DTConceptos.Columns.Add("Total", GetType(Double)) DTConceptos.Columns.Add("Total", GetType(Double))
DTConceptos.Columns.Add("Amortizacion", GetType(Double))
End Sub End Sub
'Private Sub AddPS(Cantidad As Double, UM As String, PS As String, PU As Double, IVA As Double, Descuento As Double, Optional Total As Double = 0) 'Private Sub AddPS(Cantidad As Double, UM As String, PS As String, PU As Double, IVA As Double, Descuento As Double, Optional Total As Double = 0)
' Dim Row As DataRow = Nothing ' Dim Row As DataRow = Nothing
@@ -11963,12 +12007,17 @@ Partial Class Compras_Compras
#Region " AJUSTA IMPORTES " #Region " AJUSTA IMPORTES "
Private Sub AjustaImporteUltimoConcepto(ImporteAjuste As Decimal, Optional EsCarga As Boolean = False) Private Sub AjustaImporteUltimoConcepto(ImporteAjuste As Decimal, Optional EsCarga As Boolean = False)
'Dim TempSubTotal = TxtSubTotal.Text.ToDouble 'Dim TempSubTotal = TxtSubTotal.Text.ToDouble
Dim Amortizacion As Decimal = 0
If ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 Then
Amortizacion = LblAmortizacion.Text.ToDecimal
End If
If TmpDT.Rows.Count > 0 Then ' si hay movimientos y si esta afectando al total, que se haga el ajuste If TmpDT.Rows.Count > 0 Then ' si hay movimientos y si esta afectando al total, que se haga el ajuste
'Dim ImporteAjuste As Decimal = Total - (SubTotal2 + IVA - RetencionIVA - RetencionIVA - RetencionISR + IEPS + OtrosImpuestos) 'Dim ImporteAjuste As Decimal = Total - (SubTotal2 + IVA - RetencionIVA - RetencionIVA - RetencionISR + IEPS + OtrosImpuestos)
Dim Indice As Integer = If(TmpDT.Rows(TmpDT.Rows.Count - 1)("CvePS").ToString = UsuarioActual.Empresa.Funcionalidad(112).ToString, TmpDT.Rows.Count - 2, TmpDT.Rows.Count - 1) Dim Indice As Integer = If(TmpDT.Rows(TmpDT.Rows.Count - 1)("CvePS").ToString = UsuarioActual.Empresa.Funcionalidad(112).ToString, TmpDT.Rows.Count - 2, TmpDT.Rows.Count - 1)
Dim tPU As Decimal Dim tPU As Decimal
If TmpDT.Rows(Indice)("Cantidad").ToString.ToDecimal > 0 Then If TmpDT.Rows(Indice)("Cantidad").ToString.ToDecimal > 0 Then
tPU = ImporteAjuste / TmpDT.Rows(Indice)("Cantidad").ToString.ToDecimal tPU = ImporteAjuste / TmpDT.Rows(Indice)("Cantidad").ToString.ToDecimal
Else Else
@@ -11985,7 +12034,7 @@ Partial Class Compras_Compras
Descuentos = TmpDT.SUM("Descuento").ToString.ToDecimal Descuentos = TmpDT.SUM("Descuento").ToString.ToDecimal
End If End If
TxtSubTotal.Text = (SubTotal + Descuentos).FormatoNumero() TxtSubTotal.Text = (SubTotal + Descuentos).FormatoNumero()
TxtSubTotal2.Text = SubTotal.FormatoNumero TxtSubTotal2.Text = (SubTotal - Amortizacion).FormatoNumero
TxtDescuento.Text = Descuentos.FormatoNumero() TxtDescuento.Text = Descuentos.FormatoNumero()
SubTotalConceptos = SubTotal SubTotalConceptos = SubTotal
GvPS.DataSource = TmpDT : GvPS.DataBind() GvPS.DataSource = TmpDT : GvPS.DataBind()
@@ -14864,7 +14913,11 @@ Partial Class Compras_Compras
'If DdlOCVinculaInv.SelectedValue.ToEntero = 240 And Not CveImportacion > 0 Then Alert("Necesita vincular una Importación si selecciona Factura de Importación", TipoMensaje.MsgAdvertencia) : Exit Sub 'If DdlOCVinculaInv.SelectedValue.ToEntero = 240 And Not CveImportacion > 0 Then Alert("Necesita vincular una Importación si selecciona Factura de Importación", TipoMensaje.MsgAdvertencia) : Exit Sub
Dim SubTotalGV = 0.0D Dim SubTotalGV = 0.0D
Dim SubTotalCompra = If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUMD("ImporteSinImpuestos"), TmpDT.SUM("Total").ToString.ToDecimal) Dim Amortizacion As Decimal = TmpDT.SUMD("Total")
If ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 Then
Amortizacion = TmpDT.SUMD("ImporteSinImpuestos")
End If
Dim SubTotalCompra As Decimal = Amortizacion
Dim DiferenciaPermitida = 1 Dim DiferenciaPermitida = 1
Dim Cont = 0 Dim Cont = 0
For Each gvr As GridViewRow In GvOC1.Rows For Each gvr As GridViewRow In GvOC1.Rows
@@ -14932,6 +14985,13 @@ Partial Class Compras_Compras
TotalRows += 1 TotalRows += 1
End If End If
Next Next
Dim TieneAmortizacion As Boolean = False
If ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 Then
TieneAmortizacion = True
End If
For Each gvr As GridViewRow In GvOC1.Rows For Each gvr As GridViewRow In GvOC1.Rows
If gvr.FCTextBox("TxtCantidad").Text.ToDecimal > 0 Or VinculacionCompleta Then If gvr.FCTextBox("TxtCantidad").Text.ToDecimal > 0 Or VinculacionCompleta Then
dr = DTOCGV.Rows(gvr.RowIndex) dr = DTOCGV.Rows(gvr.RowIndex)
@@ -14963,7 +15023,7 @@ Partial Class Compras_Compras
Dim RetISR As Double = dr("RetISRPorcentaje").ToString.ToDecimal Dim RetISR As Double = dr("RetISRPorcentaje").ToString.ToDecimal
Dim IEPSPS As Double = dr("IEPSPSPorcentaje").ToString.ToDecimal Dim IEPSPS As Double = dr("IEPSPSPorcentaje").ToString.ToDecimal
Dim IEPSPSIVA As Double = dr("IEPSPSIVAPorcentaje").ToString.ToDecimal Dim IEPSPSIVA As Double = dr("IEPSPSIVAPorcentaje").ToString.ToDecimal
Dim Descuento As Double = If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TxtDescuento.Text.ToDouble / TotalRows, gvr.FCHiddenField("HdnOC1Descuento").Value.ToDecimal) Dim Descuento As Double = If(TieneAmortizacion, TxtDescuento.Text.ToDouble / TotalRows, gvr.FCHiddenField("HdnOC1Descuento").Value.ToDecimal)
'Dim Descuento As Double = gvr.FCHiddenField("HdnOC1Descuento").Value.ToDecimal 'Dim Descuento As Double = gvr.FCHiddenField("HdnOC1Descuento").Value.ToDecimal
Dim CveOrdenCompraDetalle As Integer = dr("CveOrdenCompraDetalle").ToString.ToEntero Dim CveOrdenCompraDetalle As Integer = dr("CveOrdenCompraDetalle").ToString.ToEntero
Dim EntregaDirecta As Integer = dr("EntregaDirecta").ToString.ToEntero Dim EntregaDirecta As Integer = dr("EntregaDirecta").ToString.ToEntero
@@ -15012,11 +15072,10 @@ Partial Class Compras_Compras
AddPS2(False) AddPS2(False)
'AJUSTE DE REDONDEO O DIFERENCIA PERMITIDA DE IMPORTE 'AJUSTE DE REDONDEO O DIFERENCIA PERMITIDA DE IMPORTE
AjustaImporteUltimoConcepto((If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUMD("ImporteSinImpuestos"), TxtSubTotal2.Text.ToDouble) + TxtOtrosImpuestos.Text.ToDouble).ToDecimal - If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, TmpDT.SUM("ImporteSinImpuestos").ToString.ToDecimal, TmpDT.SUM("Total").ToString.ToDecimal)) AjustaImporteUltimoConcepto((If(TieneAmortizacion, TmpDT.SUMD("ImporteSinImpuestos"), TxtSubTotal2.Text.ToDouble) + TxtOtrosImpuestos.Text.ToDouble).ToDecimal - If(TieneAmortizacion, TmpDT.SUM("ImporteSinImpuestos").ToString.ToDecimal, TmpDT.SUM("Total").ToString.ToDecimal))
'AjustaImporteUltimoConcepto(TxtSubTotal2.Text.ToDecimal + TxtOtrosImpuestos.Text.ToDecimal - (TmpDT.SUM("Total").ToString.ToDecimal)) 'AjustaImporteUltimoConcepto(TxtSubTotal2.Text.ToDecimal + TxtOtrosImpuestos.Text.ToDecimal - (TmpDT.SUM("Total").ToString.ToDecimal))
BtnGuardar.Enabled = True BtnGuardar.Enabled = True
If Not CierrePeriodo Then If Not CierrePeriodo Then
BtnGuardar.Visible = True BtnGuardar.Visible = True
@@ -16492,6 +16551,16 @@ Partial Class Compras_Compras
Dim Amortizacion As Decimal = 0 Dim Amortizacion As Decimal = 0
If UsuarioActual.CveEmpresa = 119 Then If UsuarioActual.CveEmpresa = 119 Then
Amortizacion = LblAmortizacion.Text.Trim.ToDecimal Amortizacion = LblAmortizacion.Text.Trim.ToDecimal
TxtSubTotal.Text = (TxtSubTotal.Text.ToDouble + Amortizacion).ToString
End If
Dim TieneAmortizacion As Boolean = False
If ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 Then
TieneAmortizacion = True
End If
If CveCompra < 0 AndAlso Not TieneAmortizacion Then
LblAmortizacion.Text = "0.00"
End If End If
TempSubTotal = TxtSubTotal.Text.ToDouble TempSubTotal = TxtSubTotal.Text.ToDouble
@@ -16503,7 +16572,7 @@ Partial Class Compras_Compras
TempIEPS = TxtIEPS.Text.ToDouble TempIEPS = TxtIEPS.Text.ToDouble
TempRetIVA = TxtRetIVA.Text.ToDouble TempRetIVA = TxtRetIVA.Text.ToDouble
TempRetISR = TxtRetISR.Text.ToDouble TempRetISR = TxtRetISR.Text.ToDouble
TempTotal = Math.Round(TempSubTotal2 + TempIVA + TempIEPS - TempRetIVA - TempRetISR - TxtOtrosImpuestos.Text.ToDouble, 2) TempTotal = Math.Round(TempSubTotal2 + TempIVA + TempIEPS - TempRetIVA - TempRetISR - TxtOtrosImpuestos.Text.ToDouble - Amortizacion, 2)
DifTotales = TxtTotal.Text.ToDouble - TempTotal DifTotales = TxtTotal.Text.ToDouble - TempTotal
Dim DiferenciaPermitida = 0.6 Dim DiferenciaPermitida = 0.6

View File

@@ -603,6 +603,51 @@
</div> </div>
</div> </div>
</div>--%> </div>--%>
<div class="portlet light smmallpadding bordered ">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Representastes Legales</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<a href="javascript:;" class="reload" data-original-title="" title=""></a>
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
<a href="javascript:;" class="remove" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
<asp:GridView ID="GvRepresentante" runat="server" AutoGenerateColumns="False" DataKeyNames="CveRepresentanteLegal" EmptyDataText="No se encontraron Representantes" Width="100%"
ToolTip="Listado de representantes" CssClass="table table-striped table-advance table-hover" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Representante" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Literal ID="LtlProveedor" runat="server" Text='<%# Eval("RepresentanteLegal") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<%--
<asp:TemplateField HeaderText="Eliminar" ItemStyle-Width="80" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton runat="server" ID="LnkEliminar" OnClick="LnkGvRepresentantesEliminar_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>--%>
</Columns>
</asp:GridView>
</div>
</div>
</div> </div>

View File

@@ -380,6 +380,9 @@ Partial Class Compras_Proveedores
End If End If
HlEvento.Visible = True HlEvento.Visible = True
HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveProveedor=" & CveProveedor & "&TB_iframe=true&height=370&width=600;" HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveProveedor=" & CveProveedor & "&TB_iframe=true&height=370&width=600;"
CargaRepresentantes()
Else Else
'Configuración de Modalidad Insert 'Configuración de Modalidad Insert
@@ -500,6 +503,30 @@ Partial Class Compras_Proveedores
'ViewState("OUsuario") = "Usuario DESC" 'ViewState("OUsuario") = "Usuario DESC"
End Sub End Sub
Private Sub CargaRepresentantes()
If CveProveedor > 0 Then
Dim ObjProveedores As New ClsCompProveedores
If ObjProveedores.GetRePresentanteLegal(-1, UsuarioActual.CveEmpresa, CveProveedor) Then
GvRepresentante.DataSource = ObjProveedores.DtResultados
Else
GvRepresentante.DataSource = Nothing
End If
ObjProveedores.Dispose()
GvRepresentante.DataBind()
End If
End Sub
Private Sub CargaCuentasContables(Optional IdCuentaPadre As Integer = -1) Private Sub CargaCuentasContables(Optional IdCuentaPadre As Integer = -1)
If UsuarioActual.Empresa.UsaContabilidad Then If UsuarioActual.Empresa.UsaContabilidad Then
Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa)

View File

@@ -424,7 +424,7 @@ Partial Class Compras_ReembolsosComprobaciones
If UsuarioActual.CveEmpresa.Contiene(119) Then If UsuarioActual.CveEmpresa.Contiene(119) Then
CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, TxtImporteVinculado.Text.ToDecimal, TxtImporteVinculado.Text.ToDecimal, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones1", 9, TxtImporteVinculado.Text.ToDecimal, TxtImporteVinculado.Text.ToDecimal, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CveCajaChica > 0 Then If CveCajaChica > 0 Then
If ObjMov.GetRetCuenta(30, CveCajaChica) Then If ObjMov.GetRetCuenta(30, CveCajaChica) Then
@@ -448,7 +448,7 @@ Partial Class Compras_ReembolsosComprobaciones
Else Else
If drp IsNot Nothing Then If drp IsNot Nothing Then
If drp("IdPoliza").ToString.ToEntero > 0 Then If drp("IdPoliza").ToString.ToEntero > 0 Then
CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, TxtImporteVinculado.Text.ToDecimal, TxtImporteVinculado.Text.ToDecimal, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones2", 9, TxtImporteVinculado.Text.ToDecimal, TxtImporteVinculado.Text.ToDecimal, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
IdPoliza = drp("IdPoliza").ToString.ToEntero IdPoliza = drp("IdPoliza").ToString.ToEntero
Else Else
CvePrePolizaIERegistrado = drp("CvePrePoliza").ToString.ToEntero CvePrePolizaIERegistrado = drp("CvePrePoliza").ToString.ToEntero
@@ -464,14 +464,14 @@ Partial Class Compras_ReembolsosComprobaciones
End If End If
If ChkChequeExcedente.Checked Then If ChkChequeExcedente.Checked Then
CvePrePolizaExcedente = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaDocumento.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePolizaExcedente = ObjMov.AddPrePolizas("Compras/Comprobaciones3", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaDocumento.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
CveIEExcedente = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaExcedente, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False)) CveIEExcedente = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaExcedente, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False))
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, If(CveCajaChica > 0, 30, 29), TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEExcedente, CvePersonal:=CvePersonal, CveCompra:=-1, CveProveedor:=-1, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, TxtImporte.Text.ToDecimal, TxtObservaciones.Text, If(CveCajaChica > 0, 30, 29), TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEExcedente, CvePersonal:=CvePersonal, CveCompra:=-1, CveProveedor:=-1, ImporteME:=If(tipoCambio = 1, 0, TxtImporte.Text.ToDecimal), ImporteMX:=TxtImporte.Text.ToDecimal * tipoCambio) Then
MsgError = "Error al registrar detalle de concepto bancario" MsgError = "Error al registrar detalle de concepto bancario"
End If End If
End If End If
ElseIf Not ChkReembolsarSinBancos.Checked Then ElseIf Not ChkReembolsarSinBancos.Checked Then
CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaDocumento.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones4", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaDocumento.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
CveIERegistrado = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False)) CveIERegistrado = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.ToDate, TxtFolio.Text.Trim, TxtAboneA.Text, TxtImporte.Text.ToDecimal, CveMoneda, 0.0, TxtObservaciones.Text, "", ChkAbonoCuenta.Checked, True, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked, True, False))
'AGREGO PREPOLIZA IE BANCOS 'AGREGO PREPOLIZA IE BANCOS
@@ -506,7 +506,7 @@ Partial Class Compras_ReembolsosComprobaciones
End If End If
Else Else
CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones5", 9, TxtImporte.Text.ToDecimal, TxtImporte.Text.ToDecimal, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
'SI ES CAJA CHICA REGISTRO IE CAJA CHICA 'SI ES CAJA CHICA REGISTRO IE CAJA CHICA
If CveCajaChica > 0 Then If CveCajaChica > 0 Then
@@ -635,7 +635,7 @@ Partial Class Compras_ReembolsosComprobaciones
CvePrePolizaPago = CvePrePolizaIERegistrado CvePrePolizaPago = CvePrePolizaIERegistrado
'SE USARA PARA PODER ELIMINAR UNA COMPROBACION 'SE USARA PARA PODER ELIMINAR UNA COMPROBACION
CvePrePolizaPagoOriginal = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, ImporteMovto, ImporteMovto, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", $"Compra: { gvr.DataKey("SerieFolio").ToString }", TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePolizaPagoOriginal = ObjMov.AddPrePolizas("Compras/Comprobaciones6", 9, ImporteMovto, ImporteMovto, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", $"Compra: { gvr.DataKey("SerieFolio").ToString }", TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
'registramos el nuevo IE 'registramos el nuevo IE
@@ -979,7 +979,7 @@ Partial Class Compras_ReembolsosComprobaciones
ImporteMovto = ImportePagar ImporteMovto = ImportePagar
If ImportePagar = ImporteOriginal Then If ImportePagar = ImporteOriginal Then
CvePrePolizaPago = ObjMov.AddPrePolizas("Compras/Comprobaciones", 9, ImporteMovto, ImporteMovto, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", $"Compra: { gvr.DataKey("SerieFolio").ToString }", TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePolizaPago = ObjMov.AddPrePolizas("Compras/Comprobaciones7", 9, ImporteMovto, ImporteMovto, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", $"Compra: { gvr.DataKey("SerieFolio").ToString }", TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
'registramos el nuevo IE 'registramos el nuevo IE
If CveCajaChica > 0 Then If CveCajaChica > 0 Then
CveIEPago = 0 CveIEPago = 0

View File

@@ -1,4 +1,4 @@
<%@ Page Title="RH - Catálogo de Documentos" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatDocumentos.aspx.vb" Inherits="RH_CatDocumentos" %> <%@ Page Title="Catálogo de Documentos" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatDocumentos.aspx.vb" Inherits="RH_CatDocumentos" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server"> <asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">

View File

@@ -230,7 +230,7 @@
<div class="modal-header "> <div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">×</button> <button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title"> <h4 class="modal-title">
<asp:Literal ID="Literal1" runat="server">Tipo contrato</asp:Literal></h4> <asp:Literal ID="Literal1" runat="server">Representante Legal</asp:Literal></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@@ -72,6 +72,7 @@ Partial Class Proveedores_Contratos
End If End If
ObjProveedor.Dispose() ObjProveedor.Dispose()
DdlTipoContrato.DataBind() DdlTipoContrato.DataBind()
DdlTipoContrato.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlTipoContrato.Items.Insert(0, New ListItem("Seleccione", "-1"))
@@ -163,6 +164,7 @@ Partial Class Proveedores_Contratos
If Not ErrorProceso Then If Not ErrorProceso Then
ObjProv.Commit() ObjProv.Commit()
ObjProv.Dispose()
If CveContrato > 0 Then If CveContrato > 0 Then
Alert("Contrato Actualizado Correctamente.") Alert("Contrato Actualizado Correctamente.")
@@ -177,9 +179,11 @@ Partial Class Proveedores_Contratos
Else Else
ObjProv.RollBack() ObjProv.RollBack()
ObjProv.Dispose()
End If End If
ObjProv.Dispose()
@@ -198,12 +202,14 @@ Partial Class Proveedores_Contratos
ErrorProceso = True ErrorProceso = True
End If End If
ObjProv.Dispose()
If Not ErrorProceso Then If Not ErrorProceso Then
CargaDatos() CargaDatos()
End If End If
ObjProv.Dispose()
End Sub End Sub
Protected Sub BtnCatRepresentantes_Click(sender As Object, e As EventArgs) Protected Sub BtnCatRepresentantes_Click(sender As Object, e As EventArgs)

View File

@@ -787,7 +787,7 @@ Partial Class Inventarios_TraspasoAlmacen
CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, GastoIndirecto:=If(ChkTransitorio.Checked And TxtGastoIndirecto.Text.ToDouble > 0, TxtGastoIndirecto.Text, "-1").ToDouble, CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, GastoIndirecto:=If(ChkTransitorio.Checked And TxtGastoIndirecto.Text.ToDouble > 0, TxtGastoIndirecto.Text, "-1").ToDouble,
CveChofer:=If(ChkTransitorio.Checked, DdlChofer.SelectedValue.ToEntero, -1), Placa:=If(ChkTransitorio.Checked, TxtPlaca.Text.Trim, "-1"), FechaEntrega:=If(ChkTransitorio.Checked, TxtFechaEntrega.Text.Trim.ToDateTime.ToString("dd/MM/yyyy"), "-1"), EspecifUnidad:=If(ChkTransitorio.Checked, TxtEspecifUnidad.Text.Trim, "-1"), CveChofer:=If(ChkTransitorio.Checked, DdlChofer.SelectedValue.ToEntero, -1), Placa:=If(ChkTransitorio.Checked, TxtPlaca.Text.Trim, "-1"), FechaEntrega:=If(ChkTransitorio.Checked, TxtFechaEntrega.Text.Trim.ToDateTime.ToString("dd/MM/yyyy"), "-1"), EspecifUnidad:=If(ChkTransitorio.Checked, TxtEspecifUnidad.Text.Trim, "-1"),
ResponsableCarga:=If(ChkTransitorio.Checked, TxtResponsableCarga.Text.Trim, "-1"), ResponsableRecibio:=If(ChkTransitorio.Checked, TxtResponsableRecibio.Text.Trim, "-1"), Identificacion:=If(ChkTransitorio.Checked, TxtIdentificacion.Text.Trim, "-1"), Domicilio:=If(ChkTransitorio.Checked, TxtDomicilio.Text.Trim, "-1"), ResponsableCarga:=If(ChkTransitorio.Checked, TxtResponsableCarga.Text.Trim, "-1"), ResponsableRecibio:=If(ChkTransitorio.Checked, TxtResponsableRecibio.Text.Trim, "-1"), Identificacion:=If(ChkTransitorio.Checked, TxtIdentificacion.Text.Trim, "-1"), Domicilio:=If(ChkTransitorio.Checked, TxtDomicilio.Text.Trim, "-1"),
Telefono:=If(ChkTransitorio.Checked, TxtTelefono.Text.Trim, "-1"), Ciudad:=If(ChkTransitorio.Checked, TxtCiudad.Text.Trim, "-1"), Licencia:=If(ChkTransitorio.Checked, TxtLicencia.Text.Trim, "-1"), Modulo:="TA/G") Telefono:=If(ChkTransitorio.Checked, TxtTelefono.Text.Trim, "-1"), Ciudad:=If(ChkTransitorio.Checked, TxtCiudad.Text.Trim, "-1"), Licencia:=If(ChkTransitorio.Checked, TxtLicencia.Text.Trim, "-1"), Modulo:="TA/G2")
FolioSalida = ObjInventario.Folio FolioSalida = ObjInventario.Folio
Folio = ObjInventario.Folio Folio = ObjInventario.Folio
If CveMovimientoSalida <= 0 Then If CveMovimientoSalida <= 0 Then
@@ -852,7 +852,7 @@ Partial Class Inventarios_TraspasoAlmacen
AlmacenEntrada = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero) AlmacenEntrada = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero, DdlAlmacenDestino.SelectedValue.ToEntero)
CveMovimientoEntrada = ObjInventario.AddMovimiento(AlmacenEntrada, TipoMovimientoEntrada, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1, -1, CveMovimientoEntrada = ObjInventario.AddMovimiento(AlmacenEntrada, TipoMovimientoEntrada, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, -1, -1,
Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, "-1"), Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, "-1"),
CveAlmacenDestino:=If(ChkTransitorio.Checked, DdlAlmacenDestino.SelectedValue.ToEntero, -1), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G") CveAlmacenDestino:=If(ChkTransitorio.Checked, DdlAlmacenDestino.SelectedValue.ToEntero, -1), CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G3")
FolioEntrada = ObjInventario.Folio FolioEntrada = ObjInventario.Folio
If CveMovimientoEntrada <= 0 Then If CveMovimientoEntrada <= 0 Then
TextoError = "Ocurrió un error al generar el movimiento de entrada" TextoError = "Ocurrió un error al generar el movimiento de entrada"
@@ -1039,7 +1039,7 @@ Partial Class Inventarios_TraspasoAlmacen
'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN 'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN
CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacenOrigen.SelectedValue.ToEntero, CveConceptoInventario, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacenOrigen.SelectedValue.ToEntero, CveConceptoInventario, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), Observaciones:=TxtObservaciones.Text.Trim, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""),
GastoIndirecto:=If(ChkTransitorio.Checked And TxtGastoIndirecto.Text.ToDouble > 0, TxtGastoIndirecto.Text, "-1").ToDouble, Modulo:="TA/G") GastoIndirecto:=If(ChkTransitorio.Checked And TxtGastoIndirecto.Text.ToDouble > 0, TxtGastoIndirecto.Text, "-1").ToDouble, Modulo:="TA/G4")
Dim FolioMov As Integer = ObjInventario.Folio Dim FolioMov As Integer = ObjInventario.Folio
If CveMovimiento <= 0 Then If CveMovimiento <= 0 Then
@@ -1510,26 +1510,34 @@ Partial Class Inventarios_TraspasoAlmacen
Exit Sub Exit Sub
End If End If
Dim CveMovimientoEntrada As Integer = 0
Dim Folio As Integer = 0
Dim ErrorMovInv As Boolean = False
Dim TextoError As String = ""
Dim Fecha As Date = TxtFechaRecepcion.Text.ToDate
Dim ObjInventario As New ClsInventarios Dim ObjInventario As New ClsInventarios
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
ObjInventario.IniciaTransacSQL() ObjInventario.IniciaTransacSQL()
Dim CveMovimientoEntrada As Integer = 0 Try
Dim Folio = 0
Dim ErrorMovInv As Boolean = False
Dim TextoError = ""
Dim Fecha As Date = TxtFechaRecepcion.Text.ToDate
CveMovimientoEntrada = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimientoEntrada = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
Observaciones:=TxtObservacionesRecepcion.Text.Trim, Recibio:=TxtRecibio.Text, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, Observaciones:=TxtObservacionesRecepcion.Text.Trim, Recibio:=TxtRecibio.Text, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero,
CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G") CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/C")
If CveMovimientoEntrada <= 0 Then
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, TxtObservacionesRecepcion.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) TextoError = "No se pudo generar el movimiento"
If CvePrePoliza <= 0 Then
TextoError = "No se pudo generar la Poliza para la cancelacion"
ErrorMovInv = True ErrorMovInv = True
End If End If
Dim CvePrePoliza As Integer = -1
If Not ErrorMovInv Then
Folio = ObjInventario.Folio Folio = ObjInventario.Folio
CvePrePoliza = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, TxtObservacionesRecepcion.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CvePrePoliza <= 0 Then
TextoError = "No se pudo generar la Poliza para la cancelación"
ErrorMovInv = True
End If
End If
If CveMovimientoEntrada <= 0 And Not ErrorMovInv Then If CveMovimientoEntrada <= 0 And Not ErrorMovInv Then
TextoError = "No se pudo generar el movimiento de entrada correctamente" TextoError = "No se pudo generar el movimiento de entrada correctamente"
@@ -1547,6 +1555,7 @@ Partial Class Inventarios_TraspasoAlmacen
TextoError = "Ocurrió un error al guardar los movimientos de salida" TextoError = "Ocurrió un error al guardar los movimientos de salida"
Exit For Exit For
End If End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PrecioUnitario, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PrecioUnitario, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=CveMovimientoDetalleSalida) Then
ErrorMovInv = True ErrorMovInv = True
TextoError = "Ocurrió un error al guardar los movimientos de entrada" TextoError = "Ocurrió un error al guardar los movimientos de entrada"
@@ -1554,25 +1563,36 @@ Partial Class Inventarios_TraspasoAlmacen
End If End If
importe += Cantidad * PrecioUnitario importe += Cantidad * PrecioUnitario
Next Next
Else
ErrorMovInv = True
TextoError = "Ocurrió un error al obtener los movimientos de salida"
End If End If
If Not ErrorMovInv Then If Not ErrorMovInv Then
Dim ImporteDecimal As Decimal = importe.ToDecimal Dim ImporteDecimal As Decimal = importe.ToDecimal
Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteDecimal, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteDecimal, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1,
CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=ImporteDecimal) Then CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=ImporteDecimal) Then
ErrorMovInv = True ErrorMovInv = True
TextoError = "Ocurrió un erro al cancelar el traspaso"
End If End If
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1,
CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=ImporteDecimal) Then CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=ImporteDecimal) Then
ErrorMovInv = True ErrorMovInv = True
TextoError = "Ocurrió un erro al cancelar el traspaso"
End If End If
End If End If
End If End If
Catch ex As Exception
ErrorMovInv = True
TextoError = "Ocurrió un erro al cancelar el traspaso"
OnError(TextoError, ex)
End Try
If Not ErrorMovInv Then If Not ErrorMovInv Then
ObjInventario.Commit() ObjInventario.Commit()
@@ -1593,11 +1613,13 @@ Partial Class Inventarios_TraspasoAlmacen
UPDatosAlmacen.Update() UPDatosAlmacen.Update()
Else Else
ObjInventario.RollBack() ObjInventario.RollBack()
ObjConta.RollBack()
Alert(TextoError, TipoMensaje.MsgError) Alert(TextoError, TipoMensaje.MsgError)
End If End If
ObjConta.Dispose() ObjConta.Dispose()
ObjInventario.Dispose() ObjInventario.Dispose()
CargaRecepcion() CargaRecepcion()
End Sub End Sub
@@ -1648,7 +1670,7 @@ Partial Class Inventarios_TraspasoAlmacen
'AGREGAMOS LA ENTRADA 'AGREGAMOS LA ENTRADA
CveMovimientoSalida = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenDestino").ToEntero, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimientoSalida = ObjInventario.AddMovimiento(GvDatosRecepcion.Rows(0).DataKey("CveAlmacenDestino").ToEntero, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1,
Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G") Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G1")
Folio = ObjInventario.Folio Folio = ObjInventario.Folio
If CveMovimientoSalida <= 0 Then If CveMovimientoSalida <= 0 Then

View File

@@ -51,7 +51,7 @@ Partial Class CatUnidadesMedida
TxtAlias.Text = "" TxtAlias.Text = ""
Alert("El nueva Alias Unidad de Medida se guardó correctamente.", TipoMensaje.MsgInformacion) Alert("El nueva Alias Unidad de Medida se guardó correctamente.", TipoMensaje.MsgInformacion)
UpDatosAlias.Update() UpDatosAlias.Update()
GlobalDTUnidadesMedidaAlias = ObjUnidadesMedida.DtResultados GlobalDTUnidadesMedidaAlias(UsuarioActual.CveEmpresa) = Nothing
ViewState("DTUnidadesMedidaAlias") = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa).FiltraParametros("CveUnidadMedida = " & cve) ViewState("DTUnidadesMedidaAlias") = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa).FiltraParametros("CveUnidadMedida = " & cve)
End If End If
CargaGridAlias() CargaGridAlias()
@@ -281,7 +281,7 @@ Partial Class CatUnidadesMedida
TxtAbreviatura.Text = "" TxtAbreviatura.Text = ""
Alert("La nueva Unidad de Medida se guardó correctamente.", TipoMensaje.MsgInformacion) Alert("La nueva Unidad de Medida se guardó correctamente.", TipoMensaje.MsgInformacion)
UpAddUnidadMedida.Update() UpAddUnidadMedida.Update()
GlobalDTUnidadesMedida = ObjUnidadesMedida.DtResultados GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) = Nothing
ViewState("DTUnidadesMedida") = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) ViewState("DTUnidadesMedida") = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
If ViewState("Orden").ToString() <> String.Empty Then If ViewState("Orden").ToString() <> String.Empty Then
CargaGrid() CargaGrid()
@@ -344,7 +344,7 @@ Partial Class CatUnidadesMedida
UpDatos.Update() UpDatos.Update()
If ObjUnidadesMedida.RemoveUnidadMedida(HdnID.Value.ToEntero) Then If ObjUnidadesMedida.RemoveUnidadMedida(HdnID.Value.ToEntero) Then
GvDatos.EditIndex = -1 GvDatos.EditIndex = -1
GlobalDTUnidadesMedida = ObjUnidadesMedida.DtResultados GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa) = Nothing
ViewState("DTUnidadesMedida") = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) ViewState("DTUnidadesMedida") = ObjUnidadesMedida.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
Alert("La Unidad de Medida se eliminó correctamente.", TipoMensaje.MsgInformacion) Alert("La Unidad de Medida se eliminó correctamente.", TipoMensaje.MsgInformacion)
End If End If

View File

@@ -648,7 +648,8 @@
$get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaConversion, 2) + ' MXN'; $get('LbImporteMN').innerHTML = '$ ' + FormatoNumero(SumaConversion, 2) + ' MXN';
} }
} }
function FnSeleccionaNC(chk, chkNC)
function FnSeleccionaNC(chk, chkNC,txtImporte)
{ {
if (chk.checked) { if (chk.checked) {
chkNC.disabled = false; chkNC.disabled = false;
@@ -659,6 +660,11 @@
chkNC.click(); chkNC.click();
} }
} }
txtImporte.disabled = chkNC.checked;
}
function FnEditarImporte(chkNC, txtImporte) {
txtImporte.disabled = chkNC.checked;
} }
function FnLimites(chk, txt, limiteInferior, limiteSuperior) { function FnLimites(chk, txt, limiteInferior, limiteSuperior) {

View File

@@ -616,7 +616,7 @@ Partial Class Ventas_ClientesAbonar
End Select End Select
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4}); FnSeleccionaNC({5},{6});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda, e.Row.FCCheckBox("Chk").ClientID, e.Row.FCCheckBox("ChkGenerarNC").ClientID)) e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4}); FnSeleccionaNC({5},{6},{0});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda, e.Row.FCCheckBox("Chk").ClientID, e.Row.FCCheckBox("ChkGenerarNC").ClientID))
Else Else
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda)) e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), e.Row.FCCheckBox("Chk").ClientID, CveMonedaFiltro, moneda))
End If End If
@@ -646,8 +646,7 @@ Partial Class Ventas_ClientesAbonar
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then
e.Row.FCCheckBox("ChkGenerarNC").Visible = True e.Row.FCCheckBox("ChkGenerarNC").Visible = True
e.Row.FCCheckBox("ChkGenerarNC").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo").ToDecimal - e.Row.DBCampo("DescuentoProntoPago").ToDecimal, e.Row.FCCheckBox("ChkGenerarNC").ClientID, CveMonedaFiltro, moneda)) e.Row.FCCheckBox("ChkGenerarNC").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4}); FnEditarImporte({2}, {0});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo").ToDecimal - e.Row.DBCampo("DescuentoProntoPago").ToDecimal, e.Row.FCCheckBox("ChkGenerarNC").ClientID, CveMonedaFiltro, moneda))
End If End If
Else Else
@@ -1540,12 +1539,26 @@ Partial Class Ventas_ClientesAbonar
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
If MsgError = "" Then If MsgError = "" Then
If ListaFacturasGenerarNC.Count > 0 Then If ListaFacturasGenerarNC.Count > 0 Then
Dim Resp = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaFacturasGenerarNC) For Each Fac As Modelos.Factura In ListaFacturasGenerarNC
Dim ListaNC As New List(Of Modelos.Factura)
ListaNC.Add(Fac)
Dim Resp As Modelos.Factura.MMensajeFactura = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaNC)
If Resp.CveVenta > 0 Then If Resp.CveVenta > 0 Then
NCGeneradas.Add(Resp) NCGeneradas.Add(Resp)
Else Else
MsgError = "No se pudo generar la nota de credito" MsgError = "No se pudo generar la nota de crédito"
Exit For
End If End If
Next
If MsgError = "" Then
If NCGeneradas.Count <> ListaFacturasGenerarNC.Count Then
MsgError = "No se generaron las notas de crédito seleccionadas"
End If
End If
End If End If
End If End If
End If End If
@@ -1641,21 +1654,14 @@ Partial Class Ventas_ClientesAbonar
If ObjConta IsNot Nothing Then ObjConta.Commit() If ObjConta IsNot Nothing Then ObjConta.Commit()
Dim StrMsg As New StringBuilder Dim StrMsg As New StringBuilder
StrMsg.Append("Abono Registrado Correctamente.<br/>") StrMsg.AppendFormat("Abono Registrado Correctamente. Folio <b><a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>{1}</a></b> <br/>", CveIE, ObjIE.Folio)
StrMsg.AppendFormat("Folio <b><a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>{1}</a></b>", CveIE, ObjIE.Folio)
If IDPoliza > 0 Then StrMsg.AppendFormat("<br/> Poliza: <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>{1}</a>", IDPoliza, FolioPoliza) If IDPoliza > 0 Then StrMsg.AppendFormat("Poliza: <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>{1}</a> <br/>", IDPoliza, FolioPoliza)
Dim TextoComplementoPago = EmitirComplementoPago(CveIE, CveVentasPago, SeriesPago) Dim TextoComplementoPago = EmitirComplementoPago(CveIE, CveVentasPago, SeriesPago)
Dim SbMensaje As New StringBuilder
SbMensaje.Append(String.Format("Abono Registrado Correctamente.<br/><br/> Poliza: <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>{1}</a><br/><br/>{2}", IDPoliza, FolioPoliza, TextoComplementoPago))
For Each NC In NCGeneradas For Each NC In NCGeneradas
For Each msg In NC.Mensajes StrMsg.AppendFormat("Nota de crédito generada correctamente.<br/><br/> Folio: <a href='/Ventas/Ventas.aspx?CveVenta={0}' target='_blank' class='Texto'>{1}</a><br/>", NC.CveVenta, NC.SerieFolio)
StrMsg.Append(msg)
Next
StrMsg.Append("</br>")
Next Next
Alert($"{StrMsg.ToString}<br/><br/>{TextoComplementoPago}", TipoMensaje.MsgInformacion, If(ChkSeguirRegistrando.Checked, "location.href =""#""", "location.href =""/Bancos/RepCxCCliente.aspx""")) Alert($"{StrMsg.ToString}<br/><br/>{TextoComplementoPago}", TipoMensaje.MsgInformacion, If(ChkSeguirRegistrando.Checked, "location.href =""#""", "location.href =""/Bancos/RepCxCCliente.aspx"""))
@@ -1680,7 +1686,7 @@ Partial Class Ventas_ClientesAbonar
#Region " N O T A - D E - C R E D I T O" #Region " N O T A - D E - C R E D I T O"
Private Function GenerarNC(Trasac As SqlClient.SqlTransaction, ObjConta As ClsContPAQi, ListaVentasGenerarNC As List(Of Modelos.Factura)) As Modelos.Factura.MMensajeFactura Private Function GenerarNC(SqlTransaccion As SqlClient.SqlTransaction, ObjConta As ClsContPAQi, ListaVentasGenerarNC As List(Of Modelos.Factura)) As Modelos.Factura.MMensajeFactura
Dim ObjFacturaDevolucion = New Modelos.Factura(UsuarioActual) Dim ObjFacturaDevolucion = New Modelos.Factura(UsuarioActual)
ObjFacturaDevolucion.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML ObjFacturaDevolucion.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML
ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario
@@ -1844,8 +1850,8 @@ Partial Class Ventas_ClientesAbonar
DtVentasNC.AcceptChanges() DtVentasNC.AcceptChanges()
ObjFacturaDevolucion.DtVentasNC = DtVentasNC ObjFacturaDevolucion.DtVentasNC = DtVentasNC
'ObjFacturaDevolucion.GenerarPDFFactura = True
Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Transac:=Trasac, ObjContPaqTransac:=ObjConta) Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Transac:=SqlTransaccion, ObjContPaqTransac:=ObjConta)
ObjFacturaDevolucion.Dispose() ObjFacturaDevolucion.Dispose()
@@ -2371,6 +2377,11 @@ Partial Class Ventas_ClientesAbonar
#Region " COMPLEMENTOS PAGO " #Region " COMPLEMENTOS PAGO "
Private Function EmitirComplementoPago(CveIE As Integer, CveVentas As List(Of Integer), Series As List(Of String)) As String Private Function EmitirComplementoPago(CveIE As Integer, CveVentas As List(Of Integer), Series As List(Of String)) As String
If Not UsuarioActual.Empresa.FacturaProduccion Then
Return ""
End If
If Not ChkComplementoPago.Checked Then If Not ChkComplementoPago.Checked Then
Return "" Return ""
End If End If
@@ -2492,7 +2503,7 @@ Partial Class Ventas_ClientesAbonar
If CveConceptoDeduccion = 255 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(266).ToEntero If CveConceptoDeduccion = 255 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(266).ToEntero
If CveConceptoDeduccion = 211 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(559).ToEntero If CveConceptoDeduccion = 211 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(559).ToEntero
If CveConceptoDeduccion = 263 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(537).ToEntero If CveConceptoDeduccion = 263 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(537).ToEntero
If CveConceptoDeduccion = 252 Then IdCuentaContableNoDeducible = 0 If CveConceptoDeduccion = 252 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(581).ToEntero
If CveConceptoDeduccion = 78 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.IdCuentaOtrosIngresos If CveConceptoDeduccion = 78 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.IdCuentaOtrosIngresos
If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) Then If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) Then

View File

@@ -621,7 +621,8 @@
<th runat="server" visible="false" id="nomostrar2"></th> <th runat="server" visible="false" id="nomostrar2"></th>
</tr> </tr>
</table> </table>
<asp:GridView ID="GvPS" GridLines="None" runat="server" data-tableheader="#tbps" ShowHeader="true" AutoGenerateColumns="False" DataKeyNames="Consec,CvePS,Total, IEPS, CveClasificacion,CveUM,CveProyecto,CveSubProyecto,TipoDocto,PS,Obs,Cantidad,PU,Descuento,IVA,CantidadInventario,CantidadFacturadaRem" CssClass="table table-striped table-advance table-hover Widthall Sortable mysmallbtn ScrollAD" Style="min-width: 980px;"> <asp:GridView ID="GvPS" GridLines="None" runat="server" data-tableheader="#tbps" ShowHeader="true" AutoGenerateColumns="False"
DataKeyNames="CveVentaDetalle,Consec,CvePS,Total, IEPS, CveClasificacion,CveUM,CveProyecto,CveSubProyecto,TipoDocto,PS,Obs,Cantidad,PU,Descuento,IVA,CantidadInventario,CantidadFacturadaRem,EsCargo" CssClass="table table-striped table-advance table-hover Widthall Sortable mysmallbtn ScrollAD" Style="min-width: 980px;">
<Columns> <Columns>
<%--0--%> <%--0--%>
<asp:TemplateField ItemStyle-Font-Size="6pt"> <asp:TemplateField ItemStyle-Font-Size="6pt">
@@ -1331,12 +1332,18 @@
</div> </div>
<div class="portlet-body formnombottom"> <div class="portlet-body formnombottom">
<table border="0" align="center"> <table border="0" align="center">
<tr> <tr id="TrEmitir" runat="server">
<td> <td>
<asp:Button ID="BtnEmitirImprimir" runat="server" Text="Emitir e Imprimir" Style="width: 170px; padding-right: 30px;" CssClass="btn btn-primary" ValidationGroup="GrpEmitirImprimir" /> <asp:Button ID="BtnEmitirImprimir" runat="server" Text="Emitir e Imprimir" Style="width: 170px; padding-right: 30px;" CssClass="btn btn-primary" ValidationGroup="GrpEmitirImprimir" />
<i class=" fa-print fa " style="margin-left: -30px; margin-top: 10px; color: white;"></i> <i class=" fa-print fa " style="margin-left: -30px; margin-top: 10px; color: white;"></i>
</td> </td>
</tr> </tr>
<tr>
<td>
<asp:Button ID="BtnEditarRemision" runat="server" Text="Actualizar Remision" CssClass="btn myventasbutton btn-primary" Visible="false" />
<asp:Button ID="BtnPermisoEditarRemision" runat="server" Text="Editar Remision" CssClass="btn myventasbutton btn-primary" Visible="false" />
</td>
</tr>
</table> </table>
</div> </div>
</ContentTemplate> </ContentTemplate>
@@ -2827,8 +2834,7 @@
<div class="row"> <div class="row">
<div class="col-md-9"> <div class="col-md-9">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<ADS:DropDownLost ID="DdlPSAjuste" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" runat="server" CausesValidation="true" DataTextField="PSCodigo" DataValueField="CvePS" Onselectedindexchange="DdlPSAjuste_selectedindexchange" > <ADS:Dropdownlost ID="DdlPSAjuste" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" runat="server" CausesValidation="true" DataTextField="PSCodigo" DataValueField="CvePS" Onselectedindexchange="DdlPSAjuste_selectedindexchange"></ADS:Dropdownlost>
</ADS:DropDownLost>
<asp:HiddenField ID="HdnPSAjusteMarca" ClientIDMode="Static" runat="server" Value="-1" /> <asp:HiddenField ID="HdnPSAjusteMarca" ClientIDMode="Static" runat="server" Value="-1" />
<asp:HiddenField ID="HdnPSAjusteClasificacion" ClientIDMode="Static" runat="server" Value="-1" /> <asp:HiddenField ID="HdnPSAjusteClasificacion" ClientIDMode="Static" runat="server" Value="-1" />
<label for="<%= DdlPSAjuste.ClientID.ToString()%>">Producto/Servicio a Recibir:</label> <label for="<%= DdlPSAjuste.ClientID.ToString()%>">Producto/Servicio a Recibir:</label>
@@ -2876,7 +2882,7 @@
<div class="col-md-8"> <div class="col-md-8">
<div id="DivCodEnsamble" runat="server" class="form-group form-md-line-input input-iconright"> <div id="DivCodEnsamble" runat="server" class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCodEnsamble" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox> <asp:TextBox ID="TxtCodEnsamble" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<asp:CustomValidator id="CVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" ClientValidationFunction="ValidarCodigoEnsamble" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Ensamble''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" /> <asp:CustomValidator ID="CVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" ClientValidationFunction="ValidarCodigoEnsamble" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Ensamble''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
<label for="<%= TxtCodEnsamble.ClientID.ToString()%>">Cod.Ensamble:</label> <label for="<%= TxtCodEnsamble.ClientID.ToString()%>">Cod.Ensamble:</label>
</div> </div>
</div> </div>
@@ -2895,7 +2901,7 @@
<div class="col-md-8"> <div class="col-md-8">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCodLinea" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox> <asp:TextBox ID="TxtCodLinea" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<asp:CustomValidator id="CVCodLinea" runat="server" ControlToValidate="TxtCodLinea" ClientValidationFunction="ValidarCodigoLinea" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Linea''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" /> <asp:CustomValidator ID="CVCodLinea" runat="server" ControlToValidate="TxtCodLinea" ClientValidationFunction="ValidarCodigoLinea" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Linea''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
<label for="<%= TxtCodLinea.ClientID.ToString()%>">Cod.Linea:</label> <label for="<%= TxtCodLinea.ClientID.ToString()%>">Cod.Linea:</label>
</div> </div>
</div> </div>
@@ -2917,7 +2923,7 @@
<div class="col-md-8"> <div class="col-md-8">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCodInspeccion" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox> <asp:TextBox ID="TxtCodInspeccion" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<asp:CustomValidator id="CVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" ClientValidationFunction="ValidarCodigoInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" /> <asp:CustomValidator ID="CVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" ClientValidationFunction="ValidarCodigoInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
<%-- <asp:RegularExpressionValidator ID="REVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" ValidationExpression="^[A-L][0-9][1-9A-Z][A-HJ-M]$"></asp:RegularExpressionValidator>--%> <%-- <asp:RegularExpressionValidator ID="REVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" ValidationExpression="^[A-L][0-9][1-9A-Z][A-HJ-M]$"></asp:RegularExpressionValidator>--%>
<%--<asp:RequiredFieldValidator ID="RFVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspeccion''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%> <%--<asp:RequiredFieldValidator ID="RFVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspeccion''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
<%--<ajax:ValidatorCalloutExtender ID="VCECodInspeccion" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodInspeccion"></ajax:ValidatorCalloutExtender>--%> <%--<ajax:ValidatorCalloutExtender ID="VCECodInspeccion" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodInspeccion"></ajax:ValidatorCalloutExtender>--%>

View File

@@ -566,6 +566,14 @@ Partial Class PV
ViewState("Index") = value ViewState("Index") = value
End Set End Set
End Property End Property
Private Property CveVentaDetalle As Integer
Get
Return ViewState("CveVentaDetalle").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveVentaDetalle") = value
End Set
End Property
Private ReadOnly Property AplicarVentaFacturada As Boolean Private ReadOnly Property AplicarVentaFacturada As Boolean
Get Get
@@ -722,6 +730,14 @@ Partial Class PV
ViewState("TmpDTMetodosPago") = value ViewState("TmpDTMetodosPago") = value
End Set End Set
End Property End Property
Private Property DTBCIUsados As DataTable
Get
Return If(IsNothing(ViewState("DTBCIUsados")), Nothing, CType(ViewState("DTBCIUsados"), DataTable))
End Get
Set(value As DataTable)
ViewState("DTBCIUsados") = value
End Set
End Property
#End Region #End Region
@@ -1002,6 +1018,7 @@ Partial Class PV
ViewState("ClienteRetIVA") = 0 ViewState("ClienteRetIVA") = 0
ViewState("ClienteRetISR") = 0 ViewState("ClienteRetISR") = 0
ViewState("EnviarCorreoCliente") = False ViewState("EnviarCorreoCliente") = False
CveVentaDetalle = -1
EstablecioFolio = False EstablecioFolio = False
EstatusCliente = False EstatusCliente = False
RemisionesLista = New List(Of Integer) RemisionesLista = New List(Of Integer)
@@ -1112,6 +1129,12 @@ Partial Class PV
HdnCveCliente.Value = "-1" HdnCveCliente.Value = "-1"
End If End If
'CARGA VENTA
If Request("CveVenta") IsNot Nothing Then
ViewState("CveVenta") = Request("CveVenta").ToString().ToEntero()
CargaVenta()
End If
'CARGA PARA FACTURAR 'CARGA PARA FACTURAR
ViewState("CveRemision") = IfNull(Request("CveRemision").ToEntero, 0) ViewState("CveRemision") = IfNull(Request("CveRemision").ToEntero, 0)
ViewState("CveCotizacion") = IfNull(Request("CveCotizacion").ToEntero, 0) ViewState("CveCotizacion") = IfNull(Request("CveCotizacion").ToEntero, 0)
@@ -1191,6 +1214,650 @@ Partial Class PV
End If End If
End Sub End Sub
Private Function CargaVenta() As Boolean
Dim Retorno As Boolean = False
'CARGA PARA FACTURACION
Dim CveRemision As Integer = IfNull(ViewState("CveRemision"), 0).ToString.ToEntero
Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString.ToEntero
Dim CveVenta As Integer = Me.CveVenta
CveVenta = If(CveRemision > 0, CveRemision, CveVenta)
CveVenta = If(CveCotizacion > 0, CveCotizacion, CveVenta)
CveVenta = If(CvePedido > 0, CvePedido, CveVenta)
Dim SerieFolioPadre As String
Dim ObjVentas As New ClsVentas()
Try
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString.ToEntero
Dim ObjUsados As New ClsVentas
Dim DtUsados As DataTable = Nothing
If ObjUsados.GetVentasUsados(CveVenta, DdlSubProyectoDatos.SelectedValue.ToEntero(), DbRowVenta("Fecha").ToString.ToDateTime, UsuarioActual.CveEmpresa) Then
DtUsados = ObjUsados.DtResultados
End If
ObjUsados.Dispose()
'Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString.ToEntero
'CargaEncabezado
DdlTipoComprobante.SelectedValue = DbRowVenta("TipoDocto").ToString
'contado 0, credito 1, terminal 2
If ObjVentas.DtResultados(0)("CondicionesPago").ToString.ToEntero = 1 Then
RBLPago.SelectedValue = "1"
RBLPago_SelectedIndexChanged(Nothing, Nothing)
UPCondicionesPago.Update()
ElseIf ObjVentas.DtResultados(0)("CondicionesPago").ToString.ToEntero = 0 Then
RBLPago.SelectedValue = "2"
RBLPago.Items(0).Enabled = False
RBLPago_SelectedIndexChanged(Nothing, Nothing)
UPCondicionesPago.Update()
Else
DdlCuentasTerminal.SelectedValue = DbRowVenta("CveCuentaTerminal").ToString
RBLPago.SelectedValue = "3"
RBLPago.Items(0).Enabled = False
RBLPago_SelectedIndexChanged(Nothing, Nothing)
UPCondicionesPago.Update()
End If
'CargaDetalle
If ObjVentas.GetVentaDetalle(CveVenta) Then
TmpDT = ObjVentas.DtResultados.Copy()
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer))
GvPS.DataSource = TmpDT
GvPS.DataBind()
End If
'ESCONDE ACCIONES
UpnTools.Update()
HdnCveCliente.Value = CveCliente.ToString
ViewState("CveCliente") = CveCliente
ViewState("CveEmpresaCRM") = DbRowVenta("CveEmpresaCRM").ToString.ToEntero
ViewState("CveAcercamientoCRM") = DbRowVenta("CveAcercamientoCRM").ToString.ToEntero
Entrega = DbRowVenta("Entrega").ToString
Vigencia = DbRowVenta("Vigencia").ToString.ToDate.ToShortDateString
HplSaldoAuxiliar.Text = DbRowVenta("Saldo").ToString.FormatoNumero(2)
If Not HplSaldoAuxiliar.Text.ToDouble > 0 Then
HplSaldoAuxiliar.Visible = False
End If
HdnPagado.Value = DbRowVenta("Pagado").ToString
TxtTotal.Text = DbRowVenta("Total").ToString.FormatoNumero(2)
HdnVentaSaldo.Value = (SaldoVenta).ToString
CvePrePoliza = DbRowVenta("CvePrePoliza").ToString.ToEntero
CveVentaFacturada = DbRowVenta("CveVentaFacturada").ToString.ToEntero
DdlMoneda.SelectedValue = DbRowVenta("CveMoneda").ToString
CambiaMoneda()
If CveCliente > 0 Then
CargaCliente(CveCliente, -1) 'Estatus activo, se requiere para cargar una factura en la que el cliente a sido eliminado
End If
ViewState("CveAlmacenTransitorio") = DbRowVenta("CveAlmacenTraspasoDestino").ToString.ToEntero
DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString.ToEntero
'sino esta cargada la información del metodo de pago que le corresponde, la recarga para que se le pueda asignar
If DdlMetodoPago33.SelectedValue <> DbRowVenta("CveMetodoPago33").ToString Then
CargaFormaPago(DbRowVenta("CveMetodoPago33").ToString.ToEntero)
End If
DdlMetodoPago33.SelectedValueExist(DbRowVenta("CveMetodoPago33").ToString)
DdlFormaPago33.SelectedValueExist(DbRowVenta("CveFormaPago33").ToString.ToEntero)
If DdlFormaPago33.SelectedValue <> DbRowVenta("CveFormaPago33").ToString And DbRowVenta("CveFormaPago33").ToString <> "" Then
'sino está seleccionada la asginada la debe de cargar
Dim Nombre As String = GlobalDTVtaFormaPago().FiltroPrimeroValor("FormaPagoSAT", String.Format("CveFormaPago={0}", DbRowVenta("CveFormaPago33")))
DdlFormaPago33.Items.Add(New ListItem(Nombre, DbRowVenta("CveFormaPago33").ToString))
DdlFormaPago33.SelectedValueExist(DbRowVenta("CveFormaPago33").ToString.ToEntero)
End If
DdlUsoCFDI.SelectedValueExist(DbRowVenta("CveUsoCFDI").ToString)
If DbRowVenta("CveTipoRelacion").ToString.ToEntero > 0 Then
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion").ToString.ToEntero)
HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString
End If
ViewState("FolioFiscal") = DbRowVenta("FolioFiscal").ToString
LblSerie.Text = DbRowVenta("Serie").ToString
ViewState("Serie") = DbRowVenta("Serie").ToString
ViewState("Folio") = DbRowVenta("Folio").ToString.ToEntero
TxtFolio.Text = DbRowVenta("Folio").ToString
LblFolioFiscal.Text = DbRowVenta("FolioFiscal").ToString
TxtFecha.Text = DbRowVenta("Fecha").ToString
TxtSubTotal.Text = DbRowVenta("SubTotal").ToString.FormatoNumero(2)
LblDescuentos.Text = DbRowVenta("Descuento").ToString.FormatoNumero(2)
LblAmortizacion.Text = DbRowVenta("Amortizacion").ToString.FormatoNumero(2)
TxtSubTotal2.Text = (TxtSubTotal.Text.Replace(",", "").Trim.Trim.ToDouble - LblDescuentos.Text.Replace(",", "").Trim.Trim.ToDouble - LblAmortizacion.Text.Replace(",", "").Trim.Trim.ToDouble).FormatoNumero(2)
TxtIVA.Text = DbRowVenta("IVA").ToString.FormatoNumero(2)
TxtRetIVA.Text = DbRowVenta("RetIVA").ToString.FormatoNumero(2)
If TxtRetIVA.Text.ToDecimal() > 0 Then
TrRetIVA.Style.Add("display", "")
UsuarioActual.Empresa.MostrarRetIVA = True
If TmpDT IsNot Nothing Then
Dim PorcentajeRetIVA = (TmpDT.MAX("PorcentajeRetIVA").ToDecimal() * 100)
LblRetIVA.Text = PorcentajeRetIVA.FormatoNumero(2)
End If
End If
TxtRetISR.Text = DbRowVenta("RetISR").ToString.FormatoNumero(2)
TxtIEPS.Text = DbRowVenta("IEPS").ToString.FormatoNumero(2)
TrIEPS.Visible = TxtIEPS.Text.ToDouble > 0
TxtTotal.Text = DbRowVenta("Total").ToString.FormatoNumero(2)
HdnTotalVenta.Value = DbRowVenta("Total").ToString.FormatoNumero(2)
TxtMotivoDescuento.Text = DbRowVenta("MotivoDescuento").ToString
TxtObsFact.Text = DbRowVenta("Observaciones").ToString
LblUsuario.Text = DbRowVenta("Nombre").ToString
LblSeTimbro.Text = DbRowVenta("SeTimbro").ToString
LblMail.Text = DbRowVenta("EnvioMail").ToString
TxtFechaPago.Text = DbRowVenta("FechaVencimiento").ToString
TxtFechaVencimientoCotizacion.Text = Vigencia
HdnIVAOriginal.Value = TxtIVA.Text
DdlTiposRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion"))
If DbRowVenta("CveTipoRelacion").ToString.ToEntero > 0 Then
TrTipoRelacion2.Visible = True
LblTipoRelacion.Text = DbRowVenta("TipoRelacion").ToString
HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString
End If
'Envio Direccion
If DbRowVenta("CveDireccionEnvio").ToString.ToEntero > 0 AndAlso DbRowVenta("CveDireccionEnvio").ToString IsNot Nothing Then
ChkDireccionEnvio.Checked = True
DdlDireccionEnvio.SelectedValueExist(DbRowVenta("CveDireccionEnvio").ToString.ToEntero)
DdlDireccionEnvio.Enabled = False
ChkDireccionEnvio.Enabled = False
DdlDireccionEnvio.Visible = True
trDireccionEnvio.Visible = True
End If
TxtTipoCambio.Text = DbRowVenta("TipoCambio").ToString
ViewState("SelloCancelacion") = DbRowVenta("SelloCancelacion").ToString
ViewState("FechaCancelacion") = DbRowVenta("FechaCancelacion").ToString.ToDateTime
TxtAtencionA.Text = DbRowVenta("AtencionA").ToString
TxtTelefonoGenerico.Text = DbRowVenta("TelefonoGenerico").ToString
CveVentaPadre = DbRowVenta("CveVentaPadre").ToString.ToEntero
SerieFolioPadre = DbRowVenta("SerieFolioPadre").ToString
If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
DdlVendedor.Enabled = False
End If
If CveVentaPadre > 0 Then
If IsNothing(Request("CveDevolucion")) AndAlso IsNumeric(Request("CveDevolucion")) Then
DdlNCFactura.Visible = True
Else
DdlNCFactura.Visible = False
End If
trNCFactura.Visible = True
LblSerieFolioPadre.Visible = True
LblSerieFolioPadre.Text = String.Format("<a Class=""Texto"" href=""/Ventas/Ventas.aspx?CveVenta={0}"" target=""_blank"">{1}</a>", CveVentaPadre, SerieFolioPadre)
End If
DdlSucursalCliente.SelectedValueExist(DbRowVenta("CveClienteSucursal").ToString)
If DdlSubProyectoDatos.Items.Count = 0 Then
DdlSubProyectoDatos.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
DdlSubProyectoDatos.SelectedValueExistInsert(DbRowVenta("CveSubProyecto").ToString, DbRowVenta("SubProyecto").ToString)
CargarAlmacenes()
CargaClienteSucursal(DbRowVenta("CveClienteSucursal").ToString.ToEntero)
If DbRowVenta("CveContrato").ToString.ToEntero > 0 Then
CveContrato = DbRowVenta("CveContrato").ToString.ToEntero
End If
IdPoliza = DbRowVenta("IdPoliza").ToString.ToEntero
'Carga si es Contabilizada
If IdPoliza > 0 Then
HLContabilizada.Text = "Si"
HLContabilizada.NavigateUrl = $"/Contabilidad/RegPoliza.aspx?IdPoliza={DbRowVenta("IdPoliza")}"
trContabilizada.Visible = True
End If
If DbRowVenta("IdPolizaCancelacion").ToString.ToEntero > 0 Then
HPLContaCancelacion.Text = "Cancelación"
HPLContaCancelacion.NavigateUrl = String.Format("/Contabilidad/RegPoliza.aspx?IdPoliza={0}", DbRowVenta("IdPolizaCancelacion"))
trContabilizada.Visible = True
End If
'CARGA IMPUESTOS LOCALES
If ObjVentas.GetVentaImpuestosLocales(CveVenta) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TrOtros.Visible = True
TmpDTImpuestos = ObjVentas.DtResultados
GvImpuestosLocales2.DataSource = ObjVentas.DtResultados
GvImpuestosLocales2.DataBind()
GvImpuestosLocales2.Enabled = False
GvImpuestosLocales2.Visible = True
End If
End If
DdlVendedor.SelectedValue = DbRowVenta("CveVendedor").ToString
DdlTipoComprobante.Enabled = False
'TxtDocto.Enabled = False
DeshabilitarEdicion()
'CargaLeyendasFiscales
ViewState("VentaFolio") = If(LblSerie.Text.Trim.Length = 0, TxtFolio.Text.Trim, LblSerie.Text.Trim & "-" & TxtFolio.Text.Trim)
CalculaTotalesVenta(False)
tdVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
tdFechaVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
If DbRowVenta("TipoDocto").ToString = "Rem" Then
For Each Gvr As GridViewRow In GvPS.Rows
Gvr.FCLinkButton("imgE").Visible = False
Gvr.FCLinkButton("imgD").Visible = False
Next
'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR
If TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad") Then
TrEmitir.Visible = False
BtnPermisoEditarRemision.Visible = True
'ACTIVA CONVERSION DE MONEDA
If DdlMoneda.SelectedValue.ToEntero = 1 Then
TrConversionDolares.Visible = True
ChkConvertirDolares.Enabled = True
TxtTipoCambioDlls.Enabled = True
Else
TrConversionTipoCambio.Visible = True
ChkConvertirDoctoPesos.Enabled = True
TxtTipoCambio.Enabled = True
End If
End If
End If
If UsuarioActual.CveEmpresa = 48 Then
TxtFecha.AutoPostBack = True
End If
UpPS.Update()
UpContado.Update()
UpEstatus.Update()
Retorno = True
Else
ViewState("CveVenta") = -1
Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia)
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al cargar la venta", ex)
End Try
ObjVentas.Dispose()
Return Retorno
End Function
#Region "E D I T A R - R E M I S I O N"
Private Sub DeshabilitarEdicion()
'PORLET CLIENTE
'DESACTIVA CAMBIO DE CLIENTE
HlCliente.Attributes.Remove("class")
HlCliente.Attributes.Add("class", "Texto disabled")
TxtCodigo.ReadOnly = True
ChkEnviarFactura.Enabled = False
ChkDireccionEnvio.Enabled = False
TxtAtencionA.Enabled = False
TxtFechaVencimientoCotizacion.Enabled = False
TxtCantidad.Enabled = False
DdlClasificacion.Enabled = False
DdlPS.Enabled = False
TxtObsPS.Enabled = False
TxtPrecio.Enabled = False
ImgDescPU.Attributes.Clear()
ImgDescTotal.Attributes.Clear()
LbAgregar.Enabled = False
DdlCuentasTerminal.Enabled = False
For Each Row As GridViewRow In GvPS.Rows
Row.FCLiteral("LtlConsecutivo").Text = (Row.RowIndex + 1).ToString()
Next
GvPS.Columns(ColumnaEditar).HeaderText = ""
GvPS.Columns(ColumnaEliminar).HeaderText = ""
'GvPS.Columns(ColumnaEliminar).Visible = False
TxtObsFact.Enabled = False
TxtMotivoDescuento.Enabled = False
'GvLeyendasFiscales.Enabled = False
TxtSubTotal.ReadOnly = True
TxtIVA.ReadOnly = True
TxtRetIVA.ReadOnly = True
TxtRetISR.ReadOnly = True
TxtIEPS.ReadOnly = True
TxtTotal.ReadOnly = True
'Sección Detalle
DdlMoneda.Enabled = False
'DdlSucursalEjecucion.Enabled = False
'DdlSucursalCobranza.Enabled = False
DdlVendedor.Enabled = False
DdlSucursalCliente.Enabled = False
ChkConvertirDoctoPesos.Enabled = False
ChkConvertirDolares.Enabled = False
TxtTipoCambio.Enabled = False
TxtTipoCambioDlls.Enabled = False
'Condiciones de Pago
RBLPago.Enabled = False
DdlFormaPago33.Enabled = False
DdlUsoCFDI.Enabled = False
DdlMetodoPago33.Enabled = False
'TxtNumCtaPago.Enabled = False
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Then
TxtFechaPago.ReadOnly = Not UsuarioActual.TienePermisoProceso(260)
Else
TxtFechaPago.ReadOnly = False
End If
imgCalendario.Enabled = False
BtnEmitirImprimir.Visible = False
End Sub
Private Sub HabilitarEdicion()
TxtCodigo.ReadOnly = False
ChkEnviarFactura.Enabled = True
ChkDireccionEnvio.Enabled = True
TxtAtencionA.Enabled = True
TxtFechaVencimientoCotizacion.Enabled = True
TxtCantidad.Enabled = True
DdlClasificacion.Enabled = True
DdlPS.Enabled = True
TxtObsPS.Enabled = True
TxtPrecio.Enabled = True
ImgDescPU.Attributes.Clear()
ImgDescTotal.Attributes.Clear()
LbAgregar.Enabled = True
DdlCuentasTerminal.Enabled = True
For Each Row As GridViewRow In GvPS.Rows
Row.FCLiteral("LtlConsecutivo").Text = (Row.RowIndex + 1).ToString()
Next
GvPS.Columns(ColumnaEditar).HeaderText = ""
GvPS.Columns(ColumnaEliminar).HeaderText = ""
TxtObsFact.Enabled = True
TxtMotivoDescuento.Enabled = True
TxtSubTotal.ReadOnly = False
TxtIVA.ReadOnly = False
TxtRetIVA.ReadOnly = False
TxtRetISR.ReadOnly = False
TxtIEPS.ReadOnly = False
TxtTotal.ReadOnly = False
'Sección Detalle
DdlMoneda.Enabled = True
DdlVendedor.Enabled = True
DdlSucursalCliente.Enabled = True
ChkConvertirDoctoPesos.Enabled = True
ChkConvertirDolares.Enabled = True
TxtTipoCambio.Enabled = True
TxtTipoCambioDlls.Enabled = True
'Condiciones de Pago
RBLPago.Enabled = True
DdlFormaPago33.Enabled = True
DdlUsoCFDI.Enabled = True
DdlMetodoPago33.Enabled = True
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Then
TxtFechaPago.ReadOnly = Not UsuarioActual.TienePermisoProceso(260)
Else
TxtFechaPago.ReadOnly = False
End If
imgCalendario.Enabled = True
End Sub
Private Sub BtnPermisoEditarRemision_Click(sender As Object, e As EventArgs) Handles BtnPermisoEditarRemision.Click
HabilitarEdicion()
BtnPermisoEditarRemision.Visible = False
BtnEditarRemision.Visible = True
TxtObsFact.Enabled = True
DdlUsoCFDI.Enabled = True
DdlMetodoPago33.Enabled = True
DdlFormaPago33.Enabled = True
UPCondicionesPago.Update()
RBLPago.Enabled = True
ViewState("CveClienteAnterior") = CveCliente
'SI EL DETALLE NO TIENE MOVIMIENTOS DE INVENTARIO ES VISIBLE
Dim CantidadFacturadaRemision = 0.0
For Each Gvr As GridViewRow In GvPS.Rows
Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble
Next
'ACTIVA CAMBIO DE CLIENTE - SI NO TIENE NADA FACTURADO
If Not CantidadFacturadaRemision > 0 AndAlso UsuarioActual.TienePermisoProceso(284) Then
HlCliente.Attributes.Remove("class")
HlCliente.Attributes.Add("class", "Texto")
TxtCodigo.ReadOnly = False
End If
TxtCantidad.Enabled = True
DdlClasificacion.Enabled = True
DdlPS.Enabled = True
TxtObsPS.Enabled = True
TxtPrecio.Enabled = True
LbAgregar.Enabled = True
ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';")
LblSubTotal1.Text = TxtSubTotal.Text
LblAmort.Text = TxtSubTotal.Text
UpPS.Update()
UpCliente.Update()
UPObservaciones.Update()
End Sub
Private Sub BtnEditarRemision_Click(sender As Object, e As EventArgs) Handles BtnEditarRemision.Click
Dim OcurrioError As Boolean = False
CreaObjetosVenta()
Dim ObjVentas As New ClsVentas
ObjVentas.IniciaTransacSQL()
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL())
Dim ObjAC As ClsContPAQi = Nothing
Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero
Dim TipoCambio As Double = TxtTipoCambio.Text.ToDouble
Try
'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS
If DdlMoneda.SelectedValue.ToEntero <> 2 AndAlso ChkConvertirDolares.Checked Then
For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6)
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Next
Dim ImpuestosLocales As Double = 0
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal).FormatoNumero
ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
End If
Next
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
TipoCambio = TxtTipoCambioDlls.Text.Trim.ToDecimal
Moneda = 2
End If
'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES
If DdlMoneda.SelectedValue.ToEntero <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then
Dim Importe As Decimal
Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal
For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * TCC, 6)
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal * TCC, NumeroDecimales)
Importe = Row("Total").ToString.ToDecimal - Row("Descuento").ToString.ToDecimal
Row("ImporteIEPS") = Math.Round(Importe * Row("PorcentajeIEPS").ToString.ToDecimal, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Importe * Row("PorcentajeIVA").ToString.ToDecimal, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Importe * Row("PorcentajeRetIVA").ToString.ToDecimal, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Importe * Row("PorcentajeRetISR").ToString.ToDecimal, NumeroDecimales)
Next
Dim ImpuestosLocales As Double = 0
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal).FormatoNumero
ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales)
End If
Next
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
TipoCambio = 1
Moneda = 1
End If
'Actualizo los parametros de la venta
If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.ToDecimal, LblDescuentos.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtIEPS.Text.ToDecimal, TxtTotal.Text.ToDecimal, Moneda, TipoCambio, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim,
UsuarioActual.CveEmpresa, CveVenta, 0, 0,
Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1),
PedidoContrato:="", AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero,
CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, TipoDocto:="Rem", CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal,
OrdenCompra:="", RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, Kilometraje:=0) Then
OcurrioError = True
End If
'Cargo de nueva cuenta el detalle de Ventas (Conceptos)
If Not OcurrioError Then
Dim index As Integer = 0
For Each Row As DataRow In TmpDT.Rows
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero()
If CveVentaDetalle > 0 Then
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
End If
Else
If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero,
Row("PU").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString.ToDouble, Math.Round((Row("Total").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6),
Row("Obs").ToString, Row("Descuento").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero, PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal, IEPS:=Row("ImporteIEPS").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString,
CveVentaDetallePadre:=Row("CveVentaDetalle").ToString.ToEntero, CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CvePromocionDetalle:=If(DtPromociones IsNot Nothing, DtPromociones.FiltroPrimeroValor("CvePromocionDetalle", $"CvePS={Row("CvePS").ToString}").ToEntero, -1),
ImporteRetIVA:=Row("ImporteRetIVA").ToString.ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString.ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDouble, CuentaPredial:=Row("CuentaPredial").ToString) Then
OcurrioError = True
Exit For
Else
TmpDT.Rows(index)("CveVentaDetalle") = ObjVentas.CveVentaDetalle
End If
End If
index = index + 1
Next
End If
ObjFactura.DtDetalle = TmpDT
'ELIMINA LOS DETALLES
If Not OcurrioError Then
Dim DtEliminados As New DataTable
If ObjVentas.GetVentaDetalle(CveVenta) Then
DtEliminados = ObjVentas.DtResultados.FiltraParametros("", "", {"CveVentaDetalle"})
For Each Dr1 As DataRow In DtEliminados.Rows
If TmpDT.FiltraParametros($"CveVentaDetalle = {Dr1("CveVentaDetalle")}").Rows.Count = 0 Then
If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then
OcurrioError = True
End If
End If
Next
Else
OcurrioError = True
End If
End If
'OcurrioError = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, 1, ObjBancos, ObjVentas)
'Actualizo impuestos locales
If Not OcurrioError Then
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString.ToEntero, gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal) Then
OcurrioError = True
End If
End If
Next
End If
'REGENERAR LOS SALDOS
If Not OcurrioError Then
OcurrioError = Not ObjFactura.RegenerarPrePolizas(ObjVentas.IniciaTransacSQL(), ObjAC)
End If
Catch ex As Exception
OcurrioError = True
OnError("Ocurrió un error al actualizar la remisión", ex)
End Try
If OcurrioError Then
ObjVentas.RollBack()
Alert("Ocurrió un error al guardar los cambios. Por favor intente de nuevo.", TipoMensaje.MsgError)
Else
ObjVentas.Commit()
If ObjAC IsNot Nothing Then ObjAC.Commit()
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, JSBtnAceptar:="BtnRefrescarPagina();")
End If
ObjVentas.Dispose()
ObjConta.Dispose()
ObjBancos.Dispose()
If ObjAC IsNot Nothing Then ObjAC.Dispose()
End Sub
#End Region
#Region "PUNTO DE VENTA" #Region "PUNTO DE VENTA"
Private Sub CargaCorteCaja() Private Sub CargaCorteCaja()
'Checar si hay un Turno Abierto 'Checar si hay un Turno Abierto
@@ -1474,9 +2141,17 @@ Partial Class PV
'CargaDetalle 'CargaDetalle
If ObjVentas.GetVentaDetalle(CveVenta) Then If ObjVentas.GetVentaDetalle(CveVenta) Then
TmpDT = ObjVentas.DtResultados TmpDT = ObjVentas.DtResultados.Copy()
GvPS.DataSource = ObjVentas.DtResultados TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
GvPS.DataSource = TmpDT
GvPS.DataBind() GvPS.DataBind()
For Each Gvr As GridViewRow In GvPS.Rows
Gvr.FCLinkButton("imgE").Visible = False
Gvr.FCLinkButton("imgD").Visible = False
Next
End If End If
'Carga Totales 'Carga Totales
@@ -1706,6 +2381,9 @@ Partial Class PV
CambiaSucursal() CambiaSucursal()
UpParametros.Update() UpParametros.Update()
End If End If
Else
CargaFormatoSucursal()
UpParametros.Update()
End If End If
If ObjCliente.GetSucursales(CveCliente) Then If ObjCliente.GetSucursales(CveCliente) Then
@@ -1898,7 +2576,8 @@ Partial Class PV
Objeto.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) Objeto.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
Else Else
Objeto.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue) Objeto.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
Objeto.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString) 'Objeto.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString)
Objeto.ddlWS.Attributes.Add("data-cveclasificacion", "-1")
If AplicaAlmacen Then If AplicaAlmacen Then
Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas") Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas")
Else Else
@@ -2344,15 +3023,15 @@ Partial Class PV
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV)) Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV))
Next Next
Dim facBytes = DescargarFactura(Retorno.CveVenta, UsuarioActual.CveEmpresa) 'Dim facBytes = DescargarFactura(Retorno.CveVenta, UsuarioActual.CveEmpresa)
ImprimirbytesPDF(facBytes, ObjFactura.SerieFolio) 'ImprimirbytesPDF(facBytes, ObjFactura.SerieFolio)
End If End If
End If End If
End Sub End Sub
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte() Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte()
Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
Dim File As Byte() = Nothing Dim File As Byte() = Nothing
Try Try
Using httpClient = New HttpClient() Using httpClient = New HttpClient()
@@ -2377,7 +3056,14 @@ Partial Class PV
#Region "OBJETO VENTA" #Region "OBJETO VENTA"
Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False) Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False)
If Me.CveVenta > 0 Then
ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False)
Else
ObjFactura = New Modelos.Factura(UsuarioActual) ObjFactura = New Modelos.Factura(UsuarioActual)
ObjFactura.CvePrePoliza = -1
End If
ObjFactura.CveUsuario = UsuarioActual.CveUsuario ObjFactura.CveUsuario = UsuarioActual.CveUsuario
ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa
ObjFactura.TipoCambio = TxtTipoCambio.Text.Trim.ToDecimal ObjFactura.TipoCambio = TxtTipoCambio.Text.Trim.ToDecimal
@@ -2393,7 +3079,6 @@ Partial Class PV
'ObjFactura.Folio = If(ExFolioFactura, FolioXML.ToEntero, -1) 'ObjFactura.Folio = If(ExFolioFactura, FolioXML.ToEntero, -1)
ObjFactura.Serie = If(VistaPrevia, "VistaPrevia", LblSerie.Text) ObjFactura.Serie = If(VistaPrevia, "VistaPrevia", LblSerie.Text)
ObjFactura.Fecha = New Date(TxtFecha.Text.Trim.ToDate.Year, TxtFecha.Text.Trim.ToDate.Month, TxtFecha.Text.Trim.ToDate.Day, Now.Hour, Now.Minute, Now.Second) ObjFactura.Fecha = New Date(TxtFecha.Text.Trim.ToDate.Year, TxtFecha.Text.Trim.ToDate.Month, TxtFecha.Text.Trim.ToDate.Day, Now.Hour, Now.Minute, Now.Second)
ObjFactura.CvePrePoliza = -1
ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero
ObjFactura.MetodoPago = DdlMetodoPago.SelectedItem.Text ObjFactura.MetodoPago = DdlMetodoPago.SelectedItem.Text
ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago.SelectedValue}") ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago.SelectedValue}")
@@ -2801,6 +3486,7 @@ Partial Class PV
TxtDescuento.Text = FormatoNumero(0, 2) TxtDescuento.Text = FormatoNumero(0, 2)
TxtPrecio.Text = "" TxtPrecio.Text = ""
Try
If CvePSParametro > 0 Then If CvePSParametro > 0 Then
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
@@ -2868,7 +3554,7 @@ Partial Class PV
LblTotalPS.Text = "0.00" LblTotalPS.Text = "0.00"
End If End If
HdnIVAPS.Value = If(drPS("IVA").ToString = "-1", ViewState("IVA"), drPS("IVA").ToString).ToString HdnIVAPS.Value = If(drPS("IVA").ToString = "-1", SubProyectoPorcentajeIVA.ToString(), drPS("IVA").ToString).ToString
HdnIVARetAPS.Value = drPS("RetIVA").ToString HdnIVARetAPS.Value = drPS("RetIVA").ToString
HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString
HdnCtaContable.Value = drPS("IdCtaContVentas").ToString HdnCtaContable.Value = drPS("IdCtaContVentas").ToString
@@ -2906,6 +3592,9 @@ Partial Class PV
DdlUnidadMedida.SelectedValue = "-1" DdlUnidadMedida.SelectedValue = "-1"
DdlUnidadMedida.DataBind() DdlUnidadMedida.DataBind()
End If End If
Catch ex As Exception
OnError("Ocurrió un error al cambiar el producto", ex)
End Try
UpClasificacion.Update() UpClasificacion.Update()
UpPS.Update() UpPS.Update()
@@ -3339,6 +4028,7 @@ Partial Class PV
Row = TmpDT.NewRow() Row = TmpDT.NewRow()
ElseIf Modalidad = "U" Then ElseIf Modalidad = "U" Then
Dim Contador As Integer = 0 Dim Contador As Integer = 0
If CveVentaDetalle <= 0 Then
For Each Dr As DataRow In TmpDT.Rows For Each Dr As DataRow In TmpDT.Rows
If Dr("Consec").ToString.ToEntero = Index Then If Dr("Consec").ToString.ToEntero = Index Then
Exit For Exit For
@@ -3346,6 +4036,9 @@ Partial Class PV
Contador = Contador + 1 Contador = Contador + 1
Next Next
Row = TmpDT.Rows(Contador) Row = TmpDT.Rows(Contador)
Else
Row = TmpDT.Select($"CveVentaDetalle={CveVentaDetalle}")(0)
End If
End If End If
Dim TotalCalculableImpuestos As Decimal = 0 Dim TotalCalculableImpuestos As Decimal = 0
@@ -3738,6 +4431,8 @@ Partial Class PV
Modalidad = "U" Modalidad = "U"
Index = GvRow.DataKey("Consec").ToEntero Index = GvRow.DataKey("Consec").ToEntero
ConsecutivoVenta = GvRow.DataKey("Consec").ToEntero ConsecutivoVenta = GvRow.DataKey("Consec").ToEntero
CveVentaDetalle = GvRow.DataKey("CveVentaDetalle").ToEntero
LnkAgregarPS.Text = "Actualizar" LnkAgregarPS.Text = "Actualizar"
DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion")) DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion"))
CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS) CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS)
@@ -3756,7 +4451,9 @@ Partial Class PV
LblTotalPS.Text = GvRow.DataKey("Total") LblTotalPS.Text = GvRow.DataKey("Total")
ChkAgregar.Checked = False ChkAgregar.Checked = False
divagregrarotrops.Visible = False divagregrarotrops.Visible = False
If CveVenta <= 0 Then
Ajuste() Ajuste()
End If
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero()) AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
UpVenta.Update() UpVenta.Update()
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta") RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta")
@@ -3771,19 +4468,28 @@ Partial Class PV
LimpiaAgregar() LimpiaAgregar()
UpVenta.Update() UpVenta.Update()
Else Else
If Me.CveVentaDetalle > 0 Then
For Each Gvr As GridViewRow In GvPS.Rows
Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
Next
End If
UpVenta.Update()
RegistraScript("$('#DivAddVenta').modal('hide');") RegistraScript("$('#DivAddVenta').modal('hide');")
End If End If
End If End If
Me.CveVentaDetalle = -1
End Sub End Sub
Private Function AgregarPS() As Boolean Private Function AgregarPS() As Boolean
Dim CveVentaDetalle As Integer = Me.CveVentaDetalle
Dim EsCargo As Boolean = False
If CveVentaDetalle > 0 Then
EsCargo = CBool(TmpDT.FiltroPrimeroValor("EsCargo", $"CveVentaDetalle={CveVentaDetalle}"))
End If
'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL) 'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL)
Dim CvePS = -1 Dim CvePS = DdlPS.SelectedValue.ToEntero
'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, TxtCantidad.Text.ToDecimal) Then If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero, TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero, TxtCantidad.Text.ToDecimal) Then
@@ -3799,17 +4505,19 @@ Partial Class PV
Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero
Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString
Dim Consec = AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, Dim Consec = AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
CvePS, "", TxtObsPS.Text.Trim, If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal), Descuento, CvePS, "", TxtObsPS.Text.Trim, If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal), Descuento,
CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text, CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text,
SerieLote:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS) SerieLote:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CveVentaDetalle:=CveVentaDetalle, EsCargo:=EsCargo)
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
Dim ListaPSCargo = CalculaUsados(Consec) Dim ListaPSCargo = CalculaUsados(Consec)
If ListaPSCargo.Count > 0 Then If ListaPSCargo.Count > 0 Then
CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo) CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo)
End If End If
End If
Return True Return True
Else Else
Return False Return False
@@ -5040,7 +5748,8 @@ Partial Class PV
Private Sub CargaBCIAjuste() Private Sub CargaBCIAjuste()
Dim ObjGral As New ClsGenerales Dim ObjGral As New ClsGenerales
If ObjGral.BCIUsadoGet(UsuarioActual.CveEmpresa) Then If ObjGral.BCIUsadoGet(UsuarioActual.CveEmpresa) Then
DdlBCIAjuste.DataSource = ObjGral.DtResultados DTBCIUsados = ObjGral.DtResultados.Copy()
DdlBCIAjuste.DataSource = DTBCIUsados
End If End If
ObjGral.Dispose() ObjGral.Dispose()
DdlBCIAjuste.DataBind() DdlBCIAjuste.DataBind()
@@ -5065,6 +5774,8 @@ Partial Class PV
Dim DtTamanios = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo > 0") Dim DtTamanios = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo > 0")
CargaModelos() CargaModelos()
CargaBCIAjuste()
GvRecepcionUsados.DataSource = DtTamanios GvRecepcionUsados.DataSource = DtTamanios
GvRecepcionUsadosModal.DataSource = DtTamanios GvRecepcionUsadosModal.DataSource = DtTamanios
@@ -5073,13 +5784,13 @@ Partial Class PV
DdlTipoUso.DataBind() DdlTipoUso.DataBind()
DdlTipoDefecto.DataBind() DdlTipoDefecto.DataBind()
DdlFacturas.DataBind() DdlFacturas.DataBind()
GvRecepcionUsados.DataBind() GvRecepcionUsados.DataBind()
GvRecepcionUsadosModal.DataBind() GvRecepcionUsadosModal.DataBind()
CreaDTmpDTAjustes() CreaDTmpDTAjustes()
CreaDTmpDTRecepcionUsados() CreaDTmpDTRecepcionUsados()
CreaDTmpDTPolizaVirtual() CreaDTmpDTPolizaVirtual()
CargaBCIAjuste()
DdlDistribuidor.setEsWebService(True) DdlDistribuidor.setEsWebService(True)
DivChkAjuste.Visible = True DivChkAjuste.Visible = True
End Sub End Sub
@@ -5095,16 +5806,8 @@ Partial Class PV
Protected Sub GvRecepcionUsados_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvRecepcionUsados.RowDataBound Protected Sub GvRecepcionUsados_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvRecepcionUsados.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCDropDownList("DdlBCIUsado").DataSource = DTBCIUsados.FiltraParametros(String.Format("CveTamaño = {0}", e.Row.DataKey("CveTamaño")))
Dim ObjGral As New ClsGenerales
If ObjGral.BCIUsadoGet(UsuarioActual.CveEmpresa) Then
e.Row.FCDropDownList("DdlBCIUsado").DataSource = ObjGral.DtResultados.FiltraParametros(String.Format("CveTamaño = {0}", e.Row.DataKey("CveTamaño")))
End If
'DdlBCIUsado.Items.Insert(0, New ListItem("Seleccione", "-1"))
'DdlBCIUsado.SelectedValueExist(-1)
e.Row.FCDropDownList("DdlBCIUsado").DataBind() e.Row.FCDropDownList("DdlBCIUsado").DataBind()
'e.Row.FCDropDownList("DdlBCIUsado").SelectedValue = e.Row.DBCampo("CveBCIUsado")
End If End If
End Sub End Sub

View File

@@ -121,14 +121,27 @@
<div class="col-md-1 lbltitle"> <div class="col-md-1 lbltitle">
<asp:Label runat="server" Text="Tipo" AssociatedControlID="DdlTipoDocto"></asp:Label> <asp:Label runat="server" Text="Tipo" AssociatedControlID="DdlTipoDocto"></asp:Label>
</div> </div>
<div class="col-md-1">
<asp:DropDownList ID="DdlTipoDocto" runat="server" AppendDataBoundItems="true" CssClass="form-control input-small input-sm select2me" Width="100%"> <div class="col-md-2">
<asp:ListBox ID="DdlTipoDocto" data-text="Todos" SelectionMode="Multiple" CssClass="form-control ddlFiltros input-sm select2me Widthall" Style="width: 100%;" runat="server">
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Value="Ant" Text="Anticipos"></asp:ListItem>
<asp:ListItem Value="Dev" Text="Devolución"></asp:ListItem>
<asp:ListItem Value="Egs" Text="Egresos"></asp:ListItem>
<asp:ListItem Value="Ing" Text="Ingresos"></asp:ListItem>
</asp:ListBox>
<%-- <asp:DropDownList ID="DdlTipoDocto" runat="server" AppendDataBoundItems="true" CssClass="form-control input-small input-sm select2me" Width="100%">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem> <asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
<asp:ListItem Value="Ant" Text="Anticipos"></asp:ListItem> <asp:ListItem Value="Ant" Text="Anticipos"></asp:ListItem>
<asp:ListItem Value="Dev" Text="Devolución"></asp:ListItem> <asp:ListItem Value="Dev" Text="Devolución"></asp:ListItem>
<asp:ListItem Value="Egs" Text="Egresos"></asp:ListItem> <asp:ListItem Value="Egs" Text="Egresos"></asp:ListItem>
<asp:ListItem Value="Ing" Text="Ingresos"></asp:ListItem> <asp:ListItem Value="Ing" Text="Ingresos"></asp:ListItem>
</asp:DropDownList> </asp:DropDownList>--%>
</div> </div>
<div class="col-md-1 lbltitle "> <div class="col-md-1 lbltitle ">
<asp:Label runat="server" Text="Sub Proyecto" AssociatedControlID="DdlSubProyecto"></asp:Label> <asp:Label runat="server" Text="Sub Proyecto" AssociatedControlID="DdlSubProyecto"></asp:Label>

View File

@@ -84,11 +84,13 @@ Partial Class Ventas_RepIngresos
Protected Sub CargaRepIngresos(Optional tipoReporte As Integer = -1) Protected Sub CargaRepIngresos(Optional tipoReporte As Integer = -1)
Dim ObjRepI As New ClsVentas() Dim ObjRepI As New ClsVentas()
Dim Cves_Subprotectos As String = If(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM) Dim Cves_Subprotectos As String = If(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM)
Dim TiposDoc As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM)
ObjRepI.RepIngresos(UsuarioActual.CveEmpresa, If(RsFechaI = "-1", MinFecha, RsFechaI.ToDate), If(RsFechaF = "-1", MaxFecha, RsFechaF.ToDate), TipoDoc, Cves_Subprotectos) ObjRepI.RepIngresos(UsuarioActual.CveEmpresa, If(RsFechaI = "-1", MinFecha, RsFechaI.ToDate), If(RsFechaF = "-1", MaxFecha, RsFechaF.ToDate), TiposDoc, Cves_Subprotectos)
GVRepIngresos.DataSource = ObjRepI.DtResultados GVRepIngresos.DataSource = ObjRepI.DtResultados
DtDatos = ObjRepI.DtResultados DtDatos = ObjRepI.DtResultados
ObjRepI.Dispose() ObjRepI.Dispose()

View File

@@ -5272,35 +5272,30 @@
</div> </div>
<asp:UpdatePanel runat="server" ID="UpClasificacionPyME" UpdateMode="Conditional"> <asp:UpdatePanel runat="server" ID="UpClasificacionPyME" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="form-group form-md-line-input input-iconright"> <div id="DivAddClasificacionPyME" runat="server" class="form-group form-md-line-input input-iconright">
<%-- <%--<asp:HiddenField ID="HdnUnidadMedida" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField1" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField2" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField3" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField4" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField5" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField6" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField7" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField8" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField9" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField10" runat="server" Value="-1" />
<asp:HiddenField ID="HiddenField11" runat="server" Value="-1" />--%>
<asp:DropDownList ID="DdlClasificacionPyME" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="50%"> <asp:DropDownList ID="DdlClasificacionPyME" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="50%">
<asp:ListItem Selected="True" Text="Seleccione la Clasificación (Todas)" Value="-1"></asp:ListItem> <asp:ListItem Selected="True" Text="Seleccione la Clasificación (Todas)" Value="-1"></asp:ListItem>
</asp:DropDownList> </asp:DropDownList>
<label for="<%= DdlClasificacionPyME.ClientID.ToString()%>">Clasificacion:</label> <label for="<%= DdlClasificacionPyME.ClientID.ToString()%>">Clasificacion:</label>
</div> </div>
<div class="row">
<div class="col-md-12">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<ADS:Dropdownlost runat="server" ID="DdlPSPyME" CssStyle="width: 50%;" CssClass=" form-control input-sm DdlPS" CssClassDdl=" select2me " DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" /> <label for="<%= DdlPSPyME.ClientID.ToString()%>">Producto/Servicio:</label>
<ADS:Dropdownlost runat="server" ID="DdlPSPyME" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" />
</div>
</div>
</div>
<%-- <div class="form-group form-md-line-input input-iconright">
<ADS:Dropdownlost runat="server" ID="DdlPSPyME" CssStyle="width: 50%;" CssClass="form-control input-sm DdlPS" CssClassDdl="select2me " IncluyeTodos="false" DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" />
<label for="<%= DdlPSPyME.ClientID.ToString()%>"> <label for="<%= DdlPSPyME.ClientID.ToString()%>">
Productos / Servicio: Productos / Servicio:
<label> <label>
</div> </div>--%>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<br /> <br />
<div class="form-group form-md-line-input input-iconright"> <div id="DivAddUMPyME" runat="server" class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlUMPyME" AppendDataBoundItems="true" CssClass="form-control input-sm select2me " runat="server" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida" Style="width: 50%; max-width: 150px;"></asp:DropDownList> <asp:DropDownList ID="DdlUMPyME" AppendDataBoundItems="true" CssClass="form-control input-sm select2me " runat="server" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida" Style="width: 50%; max-width: 150px;"></asp:DropDownList>
<label for="<%= DdlUMPyME.ClientID.ToString()%>">Unidad de Medida:</label> <label for="<%= DdlUMPyME.ClientID.ToString()%>">Unidad de Medida:</label>
</div> </div>
@@ -5308,7 +5303,7 @@
<div> <div>
<label>Observación:</label> <label>Observación:</label>
<br /> <br />
<asp:TextBox ID="TxtObsPyME" runat="server" Height="50" Width="503px" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox> <asp:TextBox ID="TxtObsPyME" runat="server" CssClass="form-control input-sm" Height="50" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
</div> </div>
<div id="divproyectos" runat="server"> <div id="divproyectos" runat="server">
<asp:UpdatePanel ID="UPPProyecto" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPPProyecto" runat="server" UpdateMode="Conditional">
@@ -5328,12 +5323,23 @@
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPrecioPyME" runat="server" CausesValidation="true" lang="nb" ClientIDMode="Static" MaxLength="12" ValidationGroup="GrpAddVenta" CssClass="form-control"></asp:TextBox> <asp:TextBox ID="TxtPrecioPyME" runat="server" CausesValidation="true" lang="nb" ClientIDMode="Static" MaxLength="12" ValidationGroup="GrpAddVenta" CssClass="form-control"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" runat="server" TargetControlID="TxtPrecioPyME" FilterType="Custom, Numbers" ValidChars="." /> <ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" runat="server" TargetControlID="TxtPrecioPyME" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtPrecioPyME" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtPrecioPyME" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<label for="<%= TxtPrecioPyME.ClientID.ToString()%>">Precio:</label> <label for="<%= TxtPrecioPyME.ClientID.ToString()%>">Precio:</label>
</div> </div>
</div>
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtDescuentoPyME" runat="server" Enabled="false" CausesValidation="true" lang="nb" ClientIDMode="Static" MaxLength="12" CssClass="form-control"></asp:TextBox>
<label for="<%= TxtDescuentoPyME.ClientID.ToString()%>">Descuento:</label>
</div>
</div>
</div>
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
@@ -7346,6 +7352,8 @@
} }
$('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); }); $('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
$('.DdlPSPyME').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
$("body").on("mouseenter", ".select2-container.select2-container--default.select2-container--open .select2-dropdown li", function (event) { $("body").on("mouseenter", ".select2-container.select2-container--default.select2-container--open .select2-dropdown li", function (event) {
var $this = $(this); var $this = $(this);
var ind = $this.index(); var ind = $this.index();

View File

@@ -2446,7 +2446,7 @@ Partial Class Ventas
End If End If
If UsuarioActual.Empresa.CvePlataforma = 2 Then If UsuarioActual.Empresa.CvePlataforma = 2 OrElse UsuarioActual.CveRol = 1 Then
ImgOtrosConceptos.Visible = False ImgOtrosConceptos.Visible = False
TrFormaEntrega.Visible = False TrFormaEntrega.Visible = False
TabDetalleVentas.Visible = False TabDetalleVentas.Visible = False
@@ -2461,6 +2461,9 @@ Partial Class Ventas
Next Next
LnkAddVenta.Visible = True LnkAddVenta.Visible = True
divproyectos.Visible = False divproyectos.Visible = False
DivAddClasificacionPyME.Visible = False
DivAddUMPyME.Visible = False
End If End If
TabVentaAF.Visible = False TabVentaAF.Visible = False
@@ -5824,9 +5827,9 @@ Partial Class Ventas
Dim objPS As New ClsProductosServicios Dim objPS As New ClsProductosServicios
If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) Then If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) Then
PrecioMinimo = objPS.DtResultados.FiltroPrimeroValor("PrecioMinimo", "").ToDecimal PrecioMinimo = objPS.DtResultados.FiltroPrimeroValor("PrecioMinimo", "").ToDecimal
If PrecioMinimo > 0 Then 'If PrecioMinimo > 0 Then
Costo = PrecioMinimo ' Costo = PrecioMinimo
End If 'End If
End If End If
objPS.Dispose() objPS.Dispose()
@@ -5835,7 +5838,7 @@ Partial Class Ventas
If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
'VALIDA EXISTENCIA 'VALIDA EXISTENCIA
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) Then If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) Then
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS}") < TxtCantidad.Text.ToDouble Then If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia) Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
@@ -13642,6 +13645,10 @@ Partial Class Ventas
CargarAlmacenes() CargarAlmacenes()
DdlPS.Attributes.Remove("data-cvesubproyecto") DdlPS.Attributes.Remove("data-cvesubproyecto")
DdlPS.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue) DdlPS.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
DdlPSPyME.Attributes.Remove("data-cvesubproyecto")
DdlPSPyME.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
UpPS.Update() UpPS.Update()
End Sub End Sub
Private Sub CargaFolios() Private Sub CargaFolios()
@@ -14014,9 +14021,14 @@ Partial Class Ventas
Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal) Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal)
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1 Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
Dim ValidaCondicionesComerciales As Boolean = True
If DrPS IsNot Nothing AndAlso DrPS("CveClasificacion").ToString.ToEntero = 20636 Then
ValidaCondicionesComerciales = False
End If
'VERIFICA SI APLICAN CONDICIONES COMERCIALES 'VERIFICA SI APLICAN CONDICIONES COMERCIALES
If DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA 'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}") Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}")
@@ -14100,9 +14112,65 @@ Partial Class Ventas
Dim CveSubProyecto As Integer = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedValue, "0").ToString.ToEntero Dim CveSubProyecto As Integer = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedValue, "0").ToString.ToEntero
Dim SubProyecto As String = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedItem.Text, "").ToString Dim SubProyecto As String = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedItem.Text, "").ToString
AgregarProductoServicio(TxtCantidadPyME.Text.ToDecimal, DdlUMPyME.SelectedValue.ToEntero, DdlUMPyME.SelectedItem.Text, DdlClasificacionPyME.SelectedValue.ToEntero, DdlClasificacionPyME.SelectedItem.Text, Dim Descuento As Decimal = 0
DdlPSPyME.SelectedValue.ToEntero, DdlPSPyME.SelectedText, TxtObsPyME.Text, TxtPrecioPyME.Text.ToDecimal, 0, CveProyecto, Proyecto, CveSubProyecto, SubProyecto) Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal()
Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal()
Dim CvePS As Integer = DdlPSPyME.SelectedValue.ToEntero
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
Dim ValidaCondicionesComerciales As Boolean = True
If DrPS IsNot Nothing AndAlso DrPS("CveClasificacion").ToString.ToEntero = 20636 Then
ValidaCondicionesComerciales = False
End If
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}")
'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA
If RowPorcentaje IsNot Nothing Then
Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D
Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D
Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D
Dim TotalInicial As Decimal = (Cantidad * (PU)) - Descuento
Dim TotalFinal = TotalInicial
'SI APLICA EL PRIMER DESCUENTO
If PorcentajeProducto > 0 Then
Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2)
Dim Total2 = (TotalInicial - Descuento1)
'SI APLICA EL SEGUNDO DESCUENTO
If PorcentajeProducto2 > 0 Then
Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2)
Dim Total3 = (Total2 - Descuento2)
'SI APLICA EL TERCER DESCUENTO
If PorcentajeProducto3 > 0 Then
Dim Descuento3 As Decimal = (Total3 * PorcentajeProducto3).RoundSQL(2)
TotalFinal = Total3 - Descuento3
Else
TotalFinal = Total3
End If
Else
TotalFinal = Total2
End If
Else
TotalFinal = TotalInicial
End If
Descuento += ((Cantidad * PU) - TotalFinal)
End If
End If
End If
AgregarProductoServicio(Cantidad, DdlUMPyME.SelectedValue.ToEntero, DdlUMPyME.SelectedItem.Text, DdlClasificacionPyME.SelectedValue.ToEntero, DdlClasificacionPyME.SelectedItem.Text,
CvePS, DdlPSPyME.SelectedText, TxtObsPyME.Text, PU, Descuento, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
CalculaUsados()
CalculaTotalesVenta() CalculaTotalesVenta()
@@ -14624,7 +14692,7 @@ Partial Class Ventas
TmpDT.Columns.Add("CveConcepto", GetType(Integer)) TmpDT.Columns.Add("CveConcepto", GetType(Integer))
TmpDT.Columns.Add("EsOutSourcing", GetType(Boolean)) TmpDT.Columns.Add("EsOutSourcing", GetType(Boolean))
TmpDT.Columns.Add("EsUsado", GetType(Boolean)) TmpDT.Columns.Add("EsCargo", GetType(Boolean))
End Sub End Sub
Private Sub CreaDTmpC() Private Sub CreaDTmpC()
@@ -19545,9 +19613,10 @@ Partial Class Ventas
Private Sub LnkAddVenta_Click(sender As Object, e As EventArgs) Handles LnkAddVenta.Click Private Sub LnkAddVenta_Click(sender As Object, e As EventArgs) Handles LnkAddVenta.Click
Modalidad = "A" Modalidad = "A"
LnkAgregarPyME.Text = "Agregar" LnkAgregarPyME.Text = "Agregar"
TxtCantidadPyME.Text = "" TxtCantidadPyME.Text = "1"
TxtObsPyME.Text = "" TxtObsPyME.Text = ""
TxtPrecioPyME.Text = "0.00" TxtPrecioPyME.Text = "0.00"
TxtDescuentoPyME.Text = "0.00"
LblTotalPyME.Text = "0.00" LblTotalPyME.Text = "0.00"
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
DdlPSPyME.SelectedValue = "-1" DdlPSPyME.SelectedValue = "-1"
@@ -19631,18 +19700,12 @@ Partial Class Ventas
Private Sub CargaPSPyME(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost) Private Sub CargaPSPyME(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost)
DdlPSPyME.setEsWebService(If(UsuarioActual.Empresa.Funcionalidad(141).ToString = "1", True, False)) DdlPSPyME.setEsWebService(True)
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
Objeto.ddl.Items.Clear()
'Objeto.ddl.DataSource = GlobalDTProductosServicios(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion, AplicaParaVenta:=1, Estatus:=1)
Objeto.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion, AplicaParaVenta:=1, Estatus:=1)
Objeto.ddl.DataBind()
Objeto.ddl.Items.Insert(0, New ListItem("*** Actualizar listado de Productos o Servicios ***", "-2"))
Objeto.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
Else
DdlPSPyME.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue) DdlPSPyME.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
End If DdlPSPyME.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString)
DdlPSPyME.ddlWS.Attributes.Add("data-pagina", "ventas/ventas")
DdlPSPyME.ddlWS.Attributes.Add("data-Estatus", "1")
End Sub End Sub
@@ -19673,6 +19736,62 @@ Partial Class Ventas
'LblUnidadMedida.Text = PS.Rows(0)("UnidadMedida").ToString 'LblUnidadMedida.Text = PS.Rows(0)("UnidadMedida").ToString
TxtPrecioPyME.Text = drPS("Precio").ToString.FormatoNumero(2).Replace(","c, "") TxtPrecioPyME.Text = drPS("Precio").ToString.FormatoNumero(2).Replace(","c, "")
Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal()
Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal()
Dim Descuento As Decimal = 0
Dim ValidaCondicionesComerciales As Boolean = True
If drPS IsNot Nothing AndAlso drPS("CveClasificacion").ToString.ToEntero = 20636 Then
ValidaCondicionesComerciales = False
End If
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
If Not String.IsNullOrEmpty(drPS("CveMarca").ToString()) AndAlso drPS("CveMarca").ToString().ToEntero() > 0 Then
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={drPS("CveMarca").ToString()}")
'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA
If RowPorcentaje IsNot Nothing Then
Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D
Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D
Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D
Dim TotalInicial As Decimal = (Cantidad * (PU)) - Descuento
Dim TotalFinal = TotalInicial
'SI APLICA EL PRIMER DESCUENTO
If PorcentajeProducto > 0 Then
Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2)
Dim Total2 = (TotalInicial - Descuento1)
'SI APLICA EL SEGUNDO DESCUENTO
If PorcentajeProducto2 > 0 Then
Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2)
Dim Total3 = (Total2 - Descuento2)
'SI APLICA EL TERCER DESCUENTO
If PorcentajeProducto3 > 0 Then
Dim Descuento3 As Decimal = (Total3 * PorcentajeProducto3).RoundSQL(2)
TotalFinal = Total3 - Descuento3
Else
TotalFinal = Total3
End If
Else
TotalFinal = Total2
End If
Else
TotalFinal = TotalInicial
End If
Descuento += ((Cantidad * PU) - TotalFinal)
End If
End If
End If
TxtDescuentoPyME.Text = Descuento.FormatoNumero(2).Replace(","c, "")
LblTotalPyME.Text = ((Cantidad * PU) - Descuento).FormatoNumero(2).Replace(","c, "")
If UsuarioActual.CveEmpresa = 80 Then If UsuarioActual.CveEmpresa = 80 Then
'busca el precio de la sucursal 'busca el precio de la sucursal
Dim ObjPS As New ClsProductosServicios Dim ObjPS As New ClsProductosServicios
@@ -21765,7 +21884,7 @@ Partial Class Ventas
Dim AplicaPUEditado As Boolean = UsuarioActual.TienePermisoProceso(253) Dim AplicaPUEditado As Boolean = UsuarioActual.TienePermisoProceso(253)
Dim DtUsados As DataTable = TmpDT.FiltraParametros("EsUsado = True") Dim DtUsados As DataTable = TmpDT.FiltraParametros("EsCargo = True")
TmpDT.Clear() TmpDT.Clear()
For Each Gv As GridViewRow In GvAplicaDevolucion.Rows For Each Gv As GridViewRow In GvAplicaDevolucion.Rows
@@ -23939,6 +24058,10 @@ Partial Class Ventas
Private Sub CalculaUsados(Optional DtUsadosDevolucion As DataTable = Nothing) Private Sub CalculaUsados(Optional DtUsadosDevolucion As DataTable = Nothing)
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then
If ViewState("CargoUsado").ToString = "False" Then
Exit Sub
End If
Dim DTTamanios As DataTable = GlobalDTAcumTamaños() Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
Dim DTCvePSCostos As DataTable Dim DTCvePSCostos As DataTable
@@ -23948,7 +24071,17 @@ Partial Class Ventas
TmpDT.Columns.Add("Eliminar", GetType(Integer)) TmpDT.Columns.Add("Eliminar", GetType(Integer))
End If End If
For Each drow As DataRow In TmpDT.Rows
Dim TmpDTCalculo As DataRow() = Nothing
'SI ES VENTA NUEVA O SI VA SER DEVOLUCION CONSIDERAR TODOS
If Me.CveVenta <= 0 OrElse DtUsadosDevolucion IsNot Nothing Then
TmpDTCalculo = TmpDT.Rows.Cast(Of DataRow).ToArray()
'SI ES EDICION DE REMISION SOLO CONSIDERAR LOS PRODUCTOS NUEVOS
ElseIf Me.CveVenta > 0 AndAlso DtUsadosDevolucion Is Nothing AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then
TmpDTCalculo = TmpDT.Select("CveVentaDetalle IS NULL OR CveVentaDetalle <=0")
End If
For Each drow As DataRow In TmpDTCalculo
If DTCvePSCostos IsNot Nothing Then If DTCvePSCostos IsNot Nothing Then
For Each drow2 As DataRow In DTCvePSCostos.Rows For Each drow2 As DataRow In DTCvePSCostos.Rows
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
@@ -23957,7 +24090,6 @@ Partial Class Ventas
End If End If
Next Next
End If End If
Next Next
Dim TmpDTView As New DataView(TmpDT) Dim TmpDTView As New DataView(TmpDT)
@@ -23967,11 +24099,19 @@ Partial Class Ventas
dRowEliminar.Delete() dRowEliminar.Delete()
Next Next
TmpDT.AcceptChanges() 'SI ES VENTA NUEVA O SI VA SER DEVOLUCION CONSIDERAR TODOS
If ViewState("CargoUsado").ToString = "False" Then If Me.CveVenta <= 0 OrElse DtUsadosDevolucion IsNot Nothing Then
Exit Sub TmpDTCalculo = TmpDT.Rows.Cast(Of DataRow).ToArray()
'SI ES EDICION DE REMISION SOLO CONSIDERAR LOS PRODUCTOS NUEVOS
ElseIf Me.CveVenta > 0 AndAlso DtUsadosDevolucion Is Nothing AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then
TmpDTCalculo = TmpDT.Select("CveVentaDetalle IS NULL OR CveVentaDetalle <=0")
End If End If
TmpDT.AcceptChanges()
Dim CveUnidadMedidaPSA As Integer = -1 Dim CveUnidadMedidaPSA As Integer = -1
Dim UnidadMedidaPSA As String = "Unidad" Dim UnidadMedidaPSA As String = "Unidad"
Dim CveClasificacionPSA As Integer = -1 Dim CveClasificacionPSA As Integer = -1
@@ -23996,7 +24136,7 @@ Partial Class Ventas
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer)) DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
DTPSTemp.Columns.Add("SubProyecto", GetType(String)) DTPSTemp.Columns.Add("SubProyecto", GetType(String))
For Each DrowPartidas As DataRow In TmpDT.Rows For Each DrowPartidas As DataRow In TmpDTCalculo
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
If CveTamanioTemp > 0 Then If CveTamanioTemp > 0 Then

View File

@@ -17,6 +17,8 @@
<Service ID="{C0C07587-41A7-46C8-8FBD-3F9C8EBE2DDC}"/> <Service ID="{C0C07587-41A7-46C8-8FBD-3F9C8EBE2DDC}"/>
</StartupServices> </StartupServices>
</VisualWebDeveloper> </VisualWebDeveloper>