This commit is contained in:
2024-12-27 14:07:18 -07:00
8 changed files with 980 additions and 261 deletions

View File

@@ -1417,7 +1417,7 @@
<div class="Widthall" style="overflow-x: auto;">
<asp:GridView ID="GvInvMov" runat="server" AutoGenerateColumns="false" DataKeyNames="Origen" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%"
<asp:GridView ID="GvInvMov" runat="server" AutoGenerateColumns="false" DataKeyNames="Cantidad,Origen,CveAlmacen,CveUM,CvePS,CodigoPS,PU" EmptyDataText="Aun no hay registros." ShowHeaderWhenEmpty="True" Width="100%"
HeaderStyle-CssClass="Titulos" CssClass="table table-striped table-hover" GridLines="None" Visible="false">
<Columns>
<asp:TemplateField HeaderText="Cantidad" ItemStyle-Width="60px" ItemStyle-HorizontalAlign="Center">
@@ -5170,10 +5170,15 @@
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12" style="text-align:right">
<asp:CheckBox runat="server" ID="ChkEsDevolucionDevInv" Text="Es Temporal" Visible="false" />
</div>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:GridView ID="GvSolDev" runat="server" AutoGenerateColumns="false" GridLines="none" BorderWidth="0" DataKeyNames="Cantidad,CveCompraDetalle,CvePS" CssClass="table GvPS table-striped table-hover table-advance Widthall ScrollAD mysmallbtn">
<asp:GridView ID="GvSolDev" runat="server" AutoGenerateColumns="false" GridLines="none" BorderWidth="0"
DataKeyNames="Cantidad,CveCompraDetalle,CvePS,PU,CveUM,CodigoPS"
CssClass="table GvPS table-striped table-hover table-advance Widthall ScrollAD mysmallbtn">
<Columns>
<%--<%#Eval("Cantidad") %>--%>
<asp:TemplateField ItemStyle-Width="55px" HeaderText="Cant">

View File

@@ -13,7 +13,7 @@ Imports MoreLinq
Imports System.Data.SqlClient
Imports ClsPaginas
Imports Microsoft.Reporting.WebForms
Imports CrystalDecisions.[Shared]
Imports DocumentFormat.OpenXml.Math
Partial Class Compras_Compras
Inherits ClsPaginas
@@ -539,6 +539,8 @@ Partial Class Compras_Compras
ViewState("EsNoDeducible") = value
End Set
End Property
#End Region
#Region "PROPIEDADES - AC NEW"
@@ -1036,8 +1038,6 @@ Partial Class Compras_Compras
End Set
End Property
Public Property FechaCompraOriginal As Date
Get
Return ViewState("FechaCompraOriginal").ToString.ToDate
@@ -1202,22 +1202,8 @@ Partial Class Compras_Compras
End Set
End Property
'ImporteRNCSaldar = 0
'SerieFolioProntoPago = ""
'TipoCambioProntoPago = 1
'FechaProntoPago = MinFecha
'CveMonedaProntoPago = 1
#End Region
'Public Property ListaFacturasRealcionadasRNC As List(Of String)
' Get
' If ViewState("ListaFacturasRealcionadasRNC") Is Nothing Then
@@ -1230,15 +1216,37 @@ Partial Class Compras_Compras
' End Set
'End Property
Private Property EsGrupoDiaz As Boolean
Get
If ViewState("EsGrupoDiaz") Is Nothing Then
ViewState("EsGrupoDiaz") = False
End If
Return CType(ViewState("EsGrupoDiaz"), Boolean)
End Get
Set(value As Boolean)
ViewState("EsGrupoDiaz") = value
End Set
End Property
Private Property CveCompraDRMC As Integer
Get
If ViewState("CveCompraDRMC") Is Nothing Then
ViewState("CveCompraDRMC") = -1
End If
Return ViewState("CveCompraDRMC").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveCompraDRMC") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
'ImgBtnBuscarOC.Attributes.Add("data-toggle", "tooltip")
'ImgBtnBuscarOC.Attributes.Add("data-placement", "top")
EsGrupoDiaz = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False)
CargaDatosAgregarPS()
TieneAnticiposXML = False
Modalidad = ""
@@ -7196,23 +7204,23 @@ Partial Class Compras_Compras
If ImporteRNCSaldar > TotalSaldo Then ImporteRNCSaldar = TotalSaldo
If Not ErrorPrepoliza Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteRNCSaldar, ImporteRNCSaldar, 373, Referencia, Concepto, CveCompra:=CveCompraRNC, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, ImporteRNCSaldar), TipoCambio:=TipoCambio,
CveClasificacion:=-1, CveSubProyecto:=CompraActual.CveSubProyecto, Contabilizable:=True) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteRNCSaldar, ImporteRNCSaldar, 373, Referencia, Concepto, CveCompra:=CveCompraRNC, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, ImporteRNCSaldar), TipoCambio:=TipoCambio,
CveClasificacion:=-1, CveSubProyecto:=CompraActual.CveSubProyecto, Contabilizable:=True) Then
ErrorPrepoliza = True
Exit For
End If
If Not ErrorPrepoliza Then
Dim ConPrePNC As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(15, CompraActual.CveMoneda, True, CompraActual.CveTipoConceptoProveedor)
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteRNCSaldar, ImporteRNCSaldar, ConPrePNC.CveConcepto, Referencia, Concepto, CveCompra:=CompraActual.CveCompra, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, ImporteRNCSaldar), TipoCambio:=TipoCambio,
CveClasificacion:=-1, CveSubProyecto:=CompraActual.CveSubProyecto, Contabilizable:=True) Then
ErrorPrepoliza = True
Exit For
End If
If Not ErrorPrepoliza Then
Dim ConPrePNC As ConceptosTipoSaldo = ObtenerCveConceptoPrePoliza(15, CompraActual.CveMoneda, True, CompraActual.CveTipoConceptoProveedor)
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteRNCSaldar, ImporteRNCSaldar, ConPrePNC.CveConcepto, Referencia, Concepto, CveCompra:=CompraActual.CveCompra, CveProveedor:=Me.CveProveedor, ImporteME:=If(TipoCambio = 1, 0, ImporteRNCSaldar), TipoCambio:=TipoCambio,
CveClasificacion:=-1, CveSubProyecto:=CompraActual.CveSubProyecto, Contabilizable:=True) Then
ErrorPrepoliza = True
Exit For
End If
End If
End If
End If
End If
Next
If ErrorPrepoliza Then
@@ -7797,7 +7805,8 @@ Partial Class Compras_Compras
If UsuarioActual.Empresa.Funcionalidad(574) = "1" AndAlso (ImporteRNC > 0 Or ImporteRNCProntoPago > 0) Then
If Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, ObjConta, CvePrePoliza) Then
If Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, ObjConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", DdlMoneda.SelectedValue.ToEntero,
TxtSerie.Text, TxtFolio.Text) Then
TieneError = True
End If
End If
@@ -14680,6 +14689,17 @@ Partial Class Compras_Compras
ErrorCancelar = True
End Try
If Not ErrorCancelar AndAlso DdlTipoComprobante.SelectedValue = "RNC" AndAlso TxtSerie.Text.Contains("DRNC") Then
If Not ErrorCancelar Then
If Not RegistroInventarioDevTemporal(ObjCompras.IniciaTransacSQL, TmpDT.MAX("CveSubProyecto").ToEntero, CveCompra, EsCancelacion:=True) Then
ErrorCancelar = True
End If
End If
End If
If Not ErrorCancelar Then
If ObjAC IsNot Nothing Then
ObjAC.Commit()
@@ -19120,6 +19140,7 @@ Partial Class Compras_Compras
Else
HplDevv.Text = "<i class='fa fa-pencil'></i> Solicitar Devolución Almacén"
HplDevv.ToolTip = "¿Está seguro de Solicitar la Devolución de Almacén?"
ChkEsDevolucionDevInv.Visible = True
End If
End If
@@ -19145,23 +19166,95 @@ Partial Class Compras_Compras
Protected Sub BtnDevolucion_Click(sender As Object, e As EventArgs)
Dim ObjCompras As New ClsCompras
Dim TieneError As Boolean = False
Dim tCveSubProyeto As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero
ObjCompras.IniciaTransacSQL()
If ChkEsDevolucionDevInv.Checked Then
End If
Dim ImporteCompra As Decimal = 0
If EstatusAlmacen = 0 Then
For Each gvr As GridViewRow In GvSolDev.Rows
Dim Canidad As Decimal = gvr.FCTextBox("TxtCant").Text.ToDecimal
Dim PU As Decimal = gvr.DataKey("PU").ToDecimal
If gvr.FCTextBox("TxtCant").Text.ToDecimal > 0 Then
'actualiza el estatus del detalle
ObjCompras.UpdateEstatusAlmacenDetalle(gvr.DataKey("CveCompraDetalle").ToEntero, 0, UsuarioActual.CveUsuario, CantidadDevolucion:=gvr.FCTextBox("TxtCant").Text.ToDecimal)
ImporteCompra = ImporteCompra + ((PU * Canidad))
Else
ObjCompras.UpdateEstatusAlmacenDetalle(gvr.DataKey("CveCompraDetalle").ToEntero, 1, UsuarioActual.CveUsuario, CantidadDevolucion:=0)
End If
Next
End If
ImporteRNC = ImporteCompra
If ObjCompras.UpdateEstatusAlmacen(CveCompra, If(EstatusAlmacen = 1, 0, 1), UsuarioActual.CveUsuario) Then
EstatusAlmacen = If(EstatusAlmacen = 1, 0, 1)
Alert(If(EstatusAlmacen = 1, "La solicitud de devolución de almacen se guardo correctamente.", "La solicitud de almacen se canceló correctamente."))
End If
If ChkEsDevolucionDevInv.Checked Then
Dim objConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL)
CvePrePoliza = objConta.AddPrePolizas("Compras/RncDevInv", 53, ImporteCompra, TxtTotal.Text.ToDouble, DdlMoneda.SelectedValue.ToEntero, TxtFecha.Text.ToDate, $"RNC Devolucion Inv {TxtSerie.Text}-{TxtFolio.Text}",
UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo:=0, ReglaFolioPoliza:=ObjCompras.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, DdlTipoTransaccionCaja.SelectedValue,
UsuarioActual.CveEmpresa), CveTipoPoliza:=objConta.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, DdlTipoTransaccionCaja.SelectedValue, UsuarioActual.CveEmpresa))
If CvePrePoliza > 0 Then
Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
Dim CompraActual As New Compra
CompraActual.CveCompra = CveCompra
CompraActual.CveTipoConceptoProveedor = CveTipoConcepto
CompraActual.CveProveedor = CveProveedor
CompraActual.CveMoneda = DdlMoneda.SelectedValue.ToEntero
CompraActual.Fecha = TxtFecha.Text.ToDate
CompraActual.SerieFolio = TxtSerie.Text.Trim & "-" & TxtFolio.Text.Trim
CompraActual.ProveedorNombre = HplProveedor.Text
CompraActual.TC = TipoCambio
CompraActual.Total = TxtTotal.Text.ToDecimal
CompraActual.IVA = TxtIVA.Text.ToDecimal
CompraActual.IVADeducible = TxtIVA.Text.ToDecimal
CompraActual.IEPS = TxtIEPS.Text.ToDecimal
CompraActual.RetIVA = TxtRetIVA.Text.ToDecimal
CompraActual.RetISR = TxtRetISR.Text.ToDecimal
CompraActual.CveConceptoRetISR = DdlRetISRConcepto.SelectedValue.ToEntero
CompraActual.CveConceptoRetIVA = DdlRetIVAConcepto.SelectedValue.ToEntero
CompraActual.PorcentajeIVA = PorcentajeIVA
CompraActual.UsuarioActual = UsuarioActual
CompraActual.CveSubProyecto = tCveSubProyeto
CompraActual.EsImportacion = chkImportacion.Checked
If Not GeneraRNC(ObjCompras.IniciaTransacSQL, CveCompra, CompraActual, objConta, CvePrePoliza, DdlProveedor.SelectedValue.ToEntero, DdlProveedor.SelectedItem.Text, TxtFecha.Text.ToDate, $"Remisión Nota de Crédito {TxtDescripcion.Text}", DdlMoneda.SelectedValue.ToEntero,
TxtSerie.Text, TxtFolio.Text, EsDRMN:=True) Then
TieneError = True
End If
Else
TieneError = True
End If
If Not CveCompraDRMC > 0 Then
TieneError = True
End If
If Not TieneError Then
If Not RegistroInventarioDevTemporal(ObjCompras.IniciaTransacSQL, tCveSubProyeto, CveCompraDRMC, EsCancelacion:=False) Then
TieneError = True
End If
End If
End If
If Not TieneError Then
ObjCompras.Commit()
Else
@@ -19173,6 +19266,370 @@ Partial Class Compras_Compras
InicializaDevolucionAlmacen()
End Sub
Function RegistroInventarioDevTemporal(ByRef transaccion As SqlTransaction, tCveSubProyecto As Integer, CveCompraDRMCRelacionada As Integer, EsCancelacion As Boolean) As Boolean
'Dim CveConceptoInv As Integer = If(OpcionOrigen = 1, 2, 3)
Dim CveConceptoSalida As Integer = If(EsCancelacion, 2, 13)
'Dim CveConceptoEntrada As Integer = 2 'OIC FIXME Ver Con Rene
Dim Respuesta As Boolean = True
'Dim ObjOC As New ClsOC(transaccion)
Dim CveAlmacenOrigen As Integer = -1
'Dim CveAlmacenDestino As Integer = -1
For Each gvRow As GridViewRow In GvInvMov.Rows
CveAlmacenOrigen = gvRow.DataKey("CveAlmacen").ToEntero
If CveAlmacenOrigen > 0 Then
Exit For
End If
Next
If CveAlmacenOrigen <= 0 Then
Alert("Almacén de devolución proveedor no esta asignado.")
Return False
End If
'CveAlmacenDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveSubProyecto = {tCveSubProyecto} AND CveTipoAlmacen = 21 ").ToEntero
'If CveAlmacenDestino <= 0 Then
' CveAlmacenDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $" CveTipoAlmacen = 21 ").ToEntero
'End If
'If CveAlmacenDestino <= 0 Then
' Alert("Almacén destino de devolución proveedor no esta asignado.")
' Return False
'End If
Dim ObjConta As New ClsContabilidad(transaccion)
Dim ObjInventario As New ClsInventarios(transaccion)
'Dim CveConceptoInv As Integer = If(TipoTermino = 1, 3, 2)
Dim CvePrePolizaSalida As Integer = ObjConta.AddPrePolizas("Comp/InvDevSal", 53, 0, 0, 1, TxtFecha.Text.Replace(",", "").ToDate, $"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
'Dim CvePrePolizaEntrada As Integer = ObjConta.AddPrePolizas("Comp/InvDevEnt", 53, 0, 0, 1, TxtFecha.Text.Replace(",", "").ToDate, $"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenOrigen, CveConceptoSalida, 1, NowADS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompraDRMCRelacionada, -1, tCveSubProyecto, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}",
CveAlmacenDestino:=-1, Modulo:="ComprasDev/1")
Dim FolioMtoSalida As Integer = ObjInventario.Folio
Dim FolioMtoEntrada As Integer = 0 'Se asigna mas abajo
If CveMovimientoSalida <= 0 OrElse CvePrePolizaSalida <= 0 Then
Alert("No se pudo almacenar el movimiento correctamente", TipoMensaje.MsgError)
'ObjInventario.RollBack() 'deshace lo insertado
Respuesta = False
Else
Dim Mensaje As String = ""
Dim Cont As Integer = 0
If EsCancelacion Then
For Each gvRow As GridViewRow In GvInvMov.Rows
'Dim FechaCaducidadVal As Date = If(Dr("AplicaCaducidad").ToString = "True", Dr("FechaCaducidad").ToString.ToDate, MinFecha)
Dim FechaMovtoExistenciaStr As String = $"{NowADS.ToString("yyyy/MM/dd")} {NowADS.ToString("HH:mm")}"
Dim Cantidad As Decimal = gvRow.DataKey("Cantidad").ToDecimal
If Cantidad > 0 Then
Dim CveUM As Integer = gvRow.DataKey("CveUM").ToString.ToEntero
Dim CvePS As Integer = gvRow.DataKey("CvePS").ToString.ToEntero
'Dim CveCompraDetalle As Integer = gvRow.DataKey("CveCompraDetalle").ToEntero' OIC 2024-12-26 se quita relacion
Dim PU As Decimal = gvRow.DataKey("PU").ToDecimal
Dim CodigoPS As String = gvRow.DataKey("CodigoPS")
If UsuarioActual.TienePermisoProceso(114) Or EsCancelacion Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", CveUsuarioModifico:=UsuarioActual.CveUsuario,
CveOrdenCompraDetalle:=-1) Then
Mensaje = "Error al guardar los movimientos"
Respuesta = False
Exit For
End If
Else
Mensaje = String.Format("No hay existencias suficientes del producto: {0}", CodigoPS)
Alert(Mensaje, TipoMensaje.MsgAdvertencia)
Respuesta = False
Exit For
End If
Cont += 1
End If
Next
Else
For Each gvRow As GridViewRow In GvSolDev.Rows
'Dim FechaCaducidadVal As Date = If(Dr("AplicaCaducidad").ToString = "True", Dr("FechaCaducidad").ToString.ToDate, MinFecha)
Dim FechaMovtoExistenciaStr As String = $"{NowADS.ToString("yyyy/MM/dd")} {NowADS.ToString("HH:mm")}"
Dim Cantidad As Decimal = gvRow.FCTextBox("TxtCant").Text.ToDecimal
If Cantidad > 0 Then
Dim CveUM As Integer = gvRow.DataKey("CveUM").ToString.ToEntero
Dim CvePS As Integer = gvRow.DataKey("CvePS").ToString.ToEntero
'Dim CveCompraDetalle As Integer = gvRow.DataKey("CveCompraDetalle").ToEntero' OIC 2024-12-26 se quita relacion
Dim PU As Decimal = gvRow.DataKey("PU").ToDecimal
Dim CodigoPS As String = gvRow.DataKey("CodigoPS")
If ObjInventario.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlmacenOrigen, FechaMovto:=FechaMovtoExistenciaStr) >= Cantidad And Not EsCancelacion Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", CveUsuarioModifico:=UsuarioActual.CveUsuario,
CveCompraDetalle:=-1) Then
Mensaje = "Error al guardar los movimientos"
Respuesta = False
Exit For
End If
Else
If UsuarioActual.TienePermisoProceso(114) Or EsCancelacion Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", CveUsuarioModifico:=UsuarioActual.CveUsuario,
CveOrdenCompraDetalle:=-1) Then
Mensaje = "Error al guardar los movimientos"
Respuesta = False
Exit For
End If
Else
Mensaje = String.Format("No hay existencias suficientes del producto: {0}", CodigoPS)
Alert(Mensaje, TipoMensaje.MsgAdvertencia)
Respuesta = False
Exit For
End If
End If
Cont += 1
End If
Next
End If
''Se quita entrada
'Dim CveMovimientoEntrada As Integer = ObjInventario.AddMovimiento(CveAlmacenDestino, CveConceptoEntrada, 1, NowADS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, tCveSubProyecto, -1, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}",
' Modulo:="ComprasDev/2", CveMovimientoRelacionado:=CveMovimientoSalida)
'FolioMtoEntrada = ObjInventario.Folio
'If Respuesta AndAlso CveMovimientoEntrada > 0 Then
' If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
' For Each dRow As DataRow In ObjInventario.DtResultados.Rows
' Dim Cantidad As Decimal = dRow("Cantidad").ToString.ToDecimal
' If Cantidad > 0 Then
' Dim CveUM As Integer = dRow("CveUM").ToString.ToEntero
' Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
' Dim CveMovimientoDetalle As Integer = dRow("CveMovimientoDetalle").ToString.ToEntero
' Dim PU As Decimal = dRow("PU").ToString.ToDecimal
' Dim CodigoPS As String = dRow("CodigoPS").ToString
' Dim ImporteConcepto As Decimal = PU
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, CveUM, CvePS, ImporteConcepto, Observaciones:=$"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}", CveUsuarioModifico:=UsuarioActual.CveUsuario,
' CveMovimientoDetalleEntrada:=CveMovimientoDetalle) Then
' Mensaje = "Error al guardar los movimientos"
' Respuesta = False
' Exit For
' End If
' Cont += 1
' End If
' Next
' End If
'End If
'PrePoliza Movmiento de salida
Dim EsContabilizable As Boolean = False
'Registro la prepóliza
If Respuesta AndAlso ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL() '* (If(EsCancelacion, -1, 1))
'Dim tValorOtro As Decimal = tValorInventario
Dim TipoMovtoAlmacen As Boolean = False
Dim TipoMovtoOtro As Boolean = True
Dim drA2 As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacenOrigen))
If drA2 IsNot Nothing Then
tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero
End If
Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & CveConceptoSalida).ToEntero
If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True
TipoMovtoOtro = Not TipoMovtoAlmacen
Dim CveConceptoContable As Integer = 260
Dim CveClasificacion As Integer = -1
Select Case CveConceptoSalida
Case 2, 32
CveConceptoContable = 78
EsContabilizable = True
Case 28, 31
CveConceptoContable = 51
If CveConceptoSalida = 28 Then
''cuando es 28, es otros ingresos.78
CveConceptoContable = 78
End If
EsContabilizable = True
Case 30
CveConceptoContable = 181
TipoMovtoOtro = False
If DdlSubProyecto.Visible = True AndAlso DdlSubProyecto.SelectedValue.ToEntero > 0 Then tCveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero
Case 34
CveConceptoContable = 51
EsContabilizable = True
Case 13, 29
CveConceptoContable = 69
TipoMovtoOtro = True
'tValorOtro = -tValorOtro
Dim drr As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimero("")
If drr IsNot Nothing Then
CveClasificacion = drr("CveClasificacion").ToString.ToEntero
End If
Case 3
CveConceptoContable = 51
EsContabilizable = True
Case Else
CveConceptoContable = 95
End Select
'2-78
Dim Obs As String = $"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}"
If ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, TipoMovtoAlmacen, tValorInventario, tValorInventario, 68, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
Dim Dt As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}).Copy
For Each Dr As DataRow In Dt.Rows
Dim Total As Decimal = ObjInventario.DtResultados.FiltraParametros($"CveClasificacion = {Dr("CveClasificacion")}").SUM("Total").RoundSQL() ' * (If(EsCancelacion, -1, 1))
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, Not TipoMovtoAlmacen, Total, Total, 95, LblFolio.Text, Obs, 0, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=Dr("CveClasificacion").ToString.ToEntero, CveSubProyecto:=tCveSubProyecto, Contabilizable:=EsContabilizable) Then
Respuesta = False
End If
Next
'If CveConceptoContable.Contiene(181, 78, 51, 69) Then
' Dim Dt As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}).Copy
' For Each Dr As DataRow In Dt.Rows
' Dim Total As Decimal = ObjInventario.DtResultados.FiltraParametros($"CveClasificacion = {Dr("CveClasificacion")}").SUM("Total").RoundSQL()
' If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, Not TipoMovtoAlmacen, Total, Total, CveConceptoContable, LblFolio.Text, Obs, 0, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=Dr("CveClasificacion").ToString.ToEntero, CveSubProyecto:=tCveSubProyecto) Then
' Respuesta = False
' End If
' Next
'Else
' If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSalida, Not TipoMovtoAlmacen, tValorInventario, tValorInventario, CveConceptoContable, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoSalida, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
' Respuesta = False
' End If
'End If
Else
Respuesta = False
End If
Else
Respuesta = False
End If
''PrePoliza Movmiento de entrada
'If Respuesta AndAlso ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then
' Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL()
' Dim tValorOtro As Decimal = tValorInventario
' Dim TipoMovtoAlmacen As Boolean = False
' Dim TipoMovtoOtro As Boolean = True
' Dim drA2 As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacenOrigen))
' If drA2 IsNot Nothing Then
' tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero
' End If
' Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & CveConceptoEntrada).ToEntero
' If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True
' TipoMovtoOtro = Not TipoMovtoAlmacen
' Dim CveConceptoContable As Integer = 260
' Dim CveClasificacion As Integer = -1
' Select Case CveConceptoEntrada
' Case 2, 32
' CveConceptoContable = 78
' EsContabilizable = True
' Case 28, 31
' CveConceptoContable = 51
' If CveConceptoEntrada = 28 Then
' ''cuando es 28, es otros ingresos.78
' CveConceptoContable = 78
' End If
' EsContabilizable = True
' Case 30
' CveConceptoContable = 181
' TipoMovtoOtro = False
' If DdlSubProyecto.Visible = True AndAlso DdlSubProyecto.SelectedValue.ToEntero > 0 Then tCveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero
' Case 34
' CveConceptoContable = 51
' EsContabilizable = True
' Case 13, 29
' CveConceptoContable = 69
' TipoMovtoOtro = True
' tValorOtro = -tValorOtro
' Dim drr As DataRow = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimero("")
' If drr IsNot Nothing Then
' CveClasificacion = drr("CveClasificacion").ToString.ToEntero
' End If
' Case 3
' CveConceptoContable = 51
' EsContabilizable = True
' Case Else
' CveConceptoContable = 95
' End Select
' '2-78
' Dim Obs As String = $"Devolución proveedor {TxtSerie.Text}{TxtFolio.Text}"
' If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaEntrada, TipoMovtoAlmacen, tValorInventario, tValorInventario, 68, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoEntrada, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
' Respuesta = False
' Else
' 'Dim Total As Decimal = 0
' If CveConceptoContable.Contiene(181, 78, 51, 69) Then
' Dim Dt As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}).Copy
' For Each Dr As DataRow In Dt.Rows
' Dim Total As Decimal = ObjInventario.DtResultados.FiltraParametros($"CveClasificacion = {Dr("CveClasificacion")}").SUM("Total").RoundSQL()
' If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaEntrada, Not TipoMovtoAlmacen, Total, Total, CveConceptoContable, LblFolio.Text, Obs, 0, CveMovimientoAlmacen:=CveMovimientoEntrada, CveClasificacion:=Dr("CveClasificacion").ToString.ToEntero, CveSubProyecto:=tCveSubProyecto) Then
' Respuesta = False
' End If
' Next
' Else
' If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaEntrada, Not TipoMovtoAlmacen, tValorInventario, tValorInventario, CveConceptoContable, Obs, Obs, CveMovimientoAlmacen:=CveMovimientoEntrada, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then
' Respuesta = False
' End If
' End If
' End If
'Else
' Respuesta = False
'End If
End If
If Respuesta Then
Alert($"Movimientos Guardados Correctamente Folio Salida: {FolioMtoSalida}, Folio Entrada: {FolioMtoEntrada}", TipoMensaje.MsgInformacion)
End If
Return Respuesta
End Function
'Protected Sub LBDevolucionAlmacen_Click(sender As Object, e As EventArgs)
' Dim ObjCompras As New ClsCompras
@@ -21749,7 +22206,9 @@ Partial Class Compras_Compras
#Region "PRONTO PAGO"
Public Function GeneraRNC(ByRef sqltransaccion As SqlTransaction, CveCompraRegistrada As Integer, ByRef CompraActual As Compra, ByRef ObjConta As ClsContabilidad, CvePrePoliza As Integer) As Boolean
Public Function GeneraRNC(ByRef sqltransaccion As SqlTransaction, CveCompraRegistrada As Integer, ByRef CompraActual As Compra, ByRef ObjConta As ClsContabilidad, CvePrePoliza As Integer,
CveProveedor As Integer, NombreProveedor As String, Fecha As Date, Descripcion As String, CveMoneda As Integer, Serie As String, Folio As String, Optional EsDRMN As Boolean = False) As Boolean
CveCompraDRMC = -1
Dim respuesta As Boolean = True
Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
@@ -21775,15 +22234,15 @@ Partial Class Compras_Compras
Dim CompraRNC As New ClsCompraManagerCompras(UsuarioActual) With {
.CveFactura = -1,
.TipoDocto = "RNC",
.CveProveedor = DdlProveedor.SelectedValue.ToEntero,
.CveProveedor = CveProveedor,
.CveTipoProveedor = CveTipoProveedor,
.CveTipoConceptoProveedor = CveTipoConcepto,
.Descripcion = $"Remisión Nota de Crédito {TxtDescripcion.Text}",
.NombreProveedor = DdlProveedor.SelectedItem.Text,
.Fecha = TxtFecha.Text.ToDate,
.CveMoneda = DdlMoneda.SelectedValue.ToEntero,
.Serie = TxtSerie.Text,
.Folio = TxtFolio.Text,
.Descripcion = Descripcion,
.NombreProveedor = NombreProveedor,
.Fecha = Fecha,
.CveMoneda = CveMoneda,
.Serie = If(EsDRMN, $"DRNC{Serie}", Serie),
.Folio = Folio,
.CveCompraAmortizacion = CveCompraRegistrada
}
@@ -21811,6 +22270,7 @@ Partial Class Compras_Compras
Pago.AplicaAcreditable = False
Pago.TipoPago = "RNC"
Pago.Fecha = CompraActual.Fecha 'toma la misma fecha de la provisión en el pago de NC
CveCompraDRMC = CompraRNC.CveCompra
respuesta = Not AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta)
Else
respuesta = False
@@ -21820,15 +22280,15 @@ Partial Class Compras_Compras
Dim CompraRNCProntoPago As New ClsCompraManagerCompras(UsuarioActual) With {
.TipoDocto = "RNC",
.CveProveedor = DdlProveedor.SelectedValue.ToEntero,
.CveProveedor = CveProveedor,
.CveTipoProveedor = CveTipoProveedor,
.CveTipoConceptoProveedor = CveTipoConcepto,
.Descripcion = $"Remisión Nota de Crédito {TxtDescripcion.Text}",
.NombreProveedor = DdlProveedor.SelectedItem.Text,
.Fecha = TxtFecha.Text.ToDate,
.CveMoneda = DdlMoneda.SelectedValue.ToEntero,
.Serie = $"PP-{TxtSerie.Text}",
.Folio = $"{TxtFolio.Text}",
.Descripcion = Descripcion,
.NombreProveedor = NombreProveedor,
.Fecha = Fecha,
.CveMoneda = CveMoneda,
.Serie = $"PP-{Serie}",
.Folio = $"{Folio}",
.CveCompraAmortizacion = CveCompraRegistrada
}
Dim IVARNCProntoPago As Decimal = (ImporteRNCProntoPago * PorcentajeIVA).RoundSQL(2)

View File

@@ -3195,16 +3195,47 @@ Partial Class Inventarios_RecepcionUsados
Try
If DdlAlmacen.SelectedValue.ToEntero() <= 0 Then
TxtPorcentajeAjuste.Text = ""
TxtImporteAjuste.Text = "0.00"
Alert("Debe seleccionar un almacen de tipo garantía", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" Then
Dim CveMarca As Integer = -1
If String.IsNullOrEmpty(TxtEtiqueta.Text.Trim) Then
TxtPorcentajeAjuste.Text = ""
TxtImporteAjuste.Text = "0.00"
CveMarca = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimeroValor("CveMarca", "").ToEntero
Alert("Es necesario llenar el campo 'Etiqueta'", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If TxtEtiqueta.Text.Trim.Length <> 4 Then
TxtPorcentajeAjuste.Text = ""
TxtImporteAjuste.Text = "0.00"
Alert("La etiqueta no es valida", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" Then
Dim CveMarca As Integer = -1, Marca As String = ""
Dim rowPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimero("")
CveMarca = rowPS("CveMarca").ToString().ToEntero
Marca = rowPS("Marca").ToString()
Dim DtAcumMeses As DataTable = GlobalDTAcumGarantiasTipoUsoMeses(UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero)
If DtAcumMeses IsNot Nothing AndAlso DtAcumMeses.Rows.Count = 0 Then
TxtPorcentajeAjuste.Text = ""
TxtImporteAjuste.Text = "0.00"
Alert($"No se encontraron datos de garantias con los siguientes datos: <br/> Tipo de Uso :{DdlTipoUso.SelectedItem.Text}<br/> Meses :{TxtMesesUso.Text} <br/> Marca :{Marca}", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim Dtt As DataTable = Nothing
If DtAcumMeses IsNot Nothing Then
''obtener siempre y cuando la fecha de inicio sea mayor
@@ -3256,6 +3287,8 @@ Partial Class Inventarios_RecepcionUsados
'cuando no está registrada, no da ajuste
TxtImporteAjuste.ToolTip = "El producto no tiene ajuste en ese periodo"
TxtImporteAjuste.Text = "0.00"
Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia)
End If
End If
@@ -3330,7 +3363,7 @@ Partial Class Inventarios_RecepcionUsados
CalculaMesesUso()
End Sub
Protected Sub BtnCalcularImporteAjuste_Click(sender As Object, e As EventArgs)
CalculaPorcentajeAjuste()
CalculaMesesUso()
End Sub
Private Sub CalculaMesesUso()

View File

@@ -9837,7 +9837,7 @@ Partial Class OC_OC
If CveMovimiento <= 0 OrElse CvePrePoliza <= 0 Then
Alert("No se pudo almacenar el movimiento correctamente", TipoMensaje.MsgError)
ObjInventario.RollBack() 'deshace lo insertado
'ObjInventario.RollBack() 'deshace lo insertado
Respuesta = False
Else

View File

@@ -331,10 +331,10 @@
DataKeyNames="CveVenta,TipoDocto,Saldo,AtencionA,CveFormaPago33,SerieFolio,CondicionesPago,PlazoCobranza">
<Columns>
<%--<asp:BoundField HeaderText="Atención" DataField="AtencionA" />--%>
<asp:TemplateField HeaderText="Atención/Cliente" ItemStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:Label runat="server" ID="LblAtencionA" Font-Italic="true" Text='<%# Eval("AtencionA") %>' ></asp:Label><br />
<asp:Label runat="server" ID="Label4" Text='<%# Eval("NombreComercial") %>' ></asp:Label>
<asp:TemplateField HeaderText="Atención/Cliente" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label runat="server" ID="LblAtencionA" Font-Italic="true" Text='<%# Eval("AtencionA") %>'></asp:Label><br />
<asp:Label runat="server" ID="Label4" Text='<%# Eval("NombreComercial") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField HeaderText="Folio" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="SerieFolio" ItemStyle-HorizontalAlign="Center" />
@@ -401,7 +401,7 @@
<div class="row">
<div class="col-md-2">
<asp:LinkButton ID="ImgAntiPend" Visible="false" OnClick="ImgAntiPend_Click" runat="server" Text=" <i class='fa fa-money' style='font-size: 18px !important; color: #3c763d !important;'></i> " AlternateText="Aplicación de anticipos" Style="cursor: pointer;" />
&nbsp;
&nbsp;
<b>Nombre:</b>
</div>
<div class="col-md-4">&nbsp;<label><asp:Literal ID="LtlNombre" runat="server"></asp:Literal></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
@@ -553,42 +553,32 @@
</div>
</div>
<div class="chequesie1" runat="server" id="DivContadoOtros" visible="false">
<div class="row">
<asp:UpdatePanel class="chequesie1" runat="server" ID="UpContadoOtros" Visible="false" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-2">
<label>TD/TC/Trans.:</label>
</div>
<div class="col-md-4 input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtImporteOtrosContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FETxtImporteOtrosContado" runat="server" TargetControlID="TxtImporteOtrosContado" FilterType="Custom, Numbers" ValidChars=".," />
</div>
<div class="col-md-2">
<asp:DropDownList runat="server" ID="DdlOtroFormaPago" ClientIDMode="Static" AutoPostBack="true">
<asp:ListItem Value="-1">Otros</asp:ListItem>
<asp:ListItem Value="1">Credito</asp:ListItem>
<asp:ListItem Value="2">Debito</asp:ListItem>
<asp:ListItem Value="3">Cheque</asp:ListItem>
</asp:DropDownList>
<div class="col-md-2">
<asp:DropDownList runat="server" ID="DdlOtroFormaPago" CssClass="form-control input-sm select2me" AutoPostBack="true" OnSelectedIndexChanged="DdlOtroFormaPago_SelectedIndexChanged">
<asp:ListItem Value="-1">Seleccione</asp:ListItem>
<asp:ListItem Value="1">Debito</asp:ListItem>
<asp:ListItem Value="2">Crédito</asp:ListItem>
<asp:ListItem Value="3">Transferencia</asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-4">
<asp:DropDownList ID="DdlCuentaOtrosContado" runat="server" CssClass="form-control input-sm select2me" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" Width="100%"></asp:DropDownList>
</div>
</div>
<div class="col-md-4 input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtImporteOtrosContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FETxtImporteOtrosContado" runat="server" TargetControlID="TxtImporteOtrosContado" FilterType="Custom, Numbers" ValidChars=".," />
</div>
<div class="col-md-6" runat="server" id="DivContadoOtrosCuenta">
<asp:DropDownList ID="DdlCuentaOtrosContado" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" Width="100%"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="DdlCuentaTarjetaCredito" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cuenta''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpAgregarPago"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender24" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator1" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-3" runat="server" id="DivMesesSinIntereses2" visible="false">
<asp:DropDownList ID="DdlMesesSinIntereses2" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" Width="100%">
<asp:ListItem Value="-1">Meses</asp:ListItem>
<asp:ListItem Value="3">3M</asp:ListItem>
<asp:ListItem Value="6">6M</asp:ListItem>
<asp:ListItem Value="9">9M</asp:ListItem>
<asp:ListItem Value="12">12M</asp:ListItem>
</asp:DropDownList>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="chequesie2">
<div class="row">
@@ -613,10 +603,10 @@
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
<br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="chequesie2" id="divPagar">
<div class="row">
<div class="col-md-12" style="text-align: center;">
@@ -666,11 +656,11 @@
<HeaderStyle CssClass="Titulos" />
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
</asp:GridView>
</asp:GridView>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="PanelIniciarTurno" TargetControlID="btnShow"
@@ -1276,152 +1266,154 @@
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script src="/Scripts/PrintJS/print.min.js"></script>
<script type="text/javascript">
//function impresionDirecta(urlPDF) {
// printJS({ printable: urlPDF, type: 'pdf', showModal: true });
//}
//function impresionDirecta(urlPDF) {
// printJS({ printable: urlPDF, type: 'pdf', showModal: true });
//}
function chkAnt(t, txt, importe, AmorContrato = 0) {
let totalAnt = 0;
function chkAnt(t, txt, importe, AmorContrato = 0) {
let totalAnt = 0;
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
//si es con.nc,es.el.total
let Total = ToDouble($get("C_LtlSaldo").value.replace(",",""));
//si es con.nc,es.el.total
let Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));
let SaldoCompra = parseFloat(parseFloat($get("C_LtlSaldo").value.replace(",", "")).toFixed(2));
let SaldoCompra = parseFloat(parseFloat($get("C_LtlSaldo").value.replace(",", "")).toFixed(2));
if (t.checked) {
if (t.checked) {
if (SaldoCompra > 0) {
if (SaldoCompra > 0) {
if (AmorContrato > 0) {
txt.value = AmorContrato.toFixed(2);
} else {
txt.value = importe.toFixed(2);
}
totalAnt = FnSumaValoresAnt();
if (totalAnt > SaldoCompra) {
txt.value = FormatoNumero(importe - (totalAnt - SaldoCompra), 2);
//$get('HdnVentaSaldo').value = 0.00;
alert("El Importe no debe de exceder a el saldo");
}
if (AmorContrato > 0) {
txt.value = AmorContrato.toFixed(2);
} else {
txt.value = importe.toFixed(2);
}
totalAnt = FnSumaValoresAnt();
if (totalAnt > SaldoCompra) {
txt.value = FormatoNumero(importe - (totalAnt - SaldoCompra), 2);
//$get('HdnVentaSaldo').value = 0.00;
alert("El Importe no debe de exceder a el saldo");
t.checked = false;
}
} else {
t.checked = false;
//$get('HdnVentaSaldo').value = parseFloat(SaldoCompra) + parseFloat(txt.value);
txt.value = "";
}
} else {
//$get('HdnVentaSaldo').value = parseFloat(SaldoCompra) + parseFloat(txt.value);
txt.value = "";
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
}
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
}
function FnCambiaAnt(chk, txt, saldo) {
function FnCambiaAnt(chk, txt, saldo) {
let Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));// ToDouble($get('TxtSubTotal').value);
let Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));// ToDouble($get('TxtSubTotal').value);
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
if (TipoAnticipo == '4') {
Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));
}
if (TipoAnticipo == '4') {
Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));
}
if (isNaN(importeTxt)) {
importeTxt = 0;
} else {
if (importeTxt <= 0) {
if (isNaN(importeTxt)) {
importeTxt = 0;
chk.checked = false;
return;
} else {
if (importeTxt <= 0) {
importeTxt = 0;
chk.checked = false;
return;
}
}
saldo = (importeTxt > saldo) ? saldo : importeTxt;
var SaldoCompra = (Total - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
if (SaldoCompra < 0) txt.value = SaldoCompra - txt.value;
//minimo entre saldocompra y el saldoanticipo
if (SaldoCompra < saldo) saldo = SaldoCompra;
if (ToDouble(txt.value) > 0) {
chk.checked = true;
} else {
chk.checked = false;
}
if (ToDouble(txt.value) > saldo) {
txt.value = saldo;
alert("El Importe no debe de exceder a el saldo");
}
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
// $get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
}
saldo = (importeTxt > saldo) ? saldo : importeTxt;
function FnSumaValoresAnt() {
let totalPoints = 0;
let t = '';
$('input[name*=TxtAnticipo]').each(function () {
totalPoints += ToDouble($(this).val());
});
var SaldoCompra = (Total - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
if (SaldoCompra < 0) txt.value = SaldoCompra - txt.value;
//minimo entre saldocompra y el saldoanticipo
if (SaldoCompra < saldo) saldo = SaldoCompra;
return Math.round(totalPoints * 100) / 100;
}
if (ToDouble(txt.value) > 0) {
chk.checked = true;
} else {
chk.checked = false;
}
if (ToDouble(txt.value) > saldo) {
txt.value = saldo;
alert("El Importe no debe de exceder a el saldo");
}
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
// $get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
}
function FnSumaValoresAnt() {
let totalPoints = 0;
let t = '';
$('input[name*=TxtAnticipo]').each(function () {
totalPoints += ToDouble($(this).val());
});
return Math.round(totalPoints * 100) / 100;
}
function impresionBase64(pdfBase64) {
printJS({ printable: pdfBase64, type: 'pdf', showModal: true, base64: true });
}
function CalculaTotalPagoContado() {
let totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
let totalCredito = ToDouble($get("TxtImporteCredito").value);
let totalDebito = ToDouble($get("TxtImporteDebito").value);
let totalCheque = ToDouble($get("TxtImporteCheque").value);
let totalTransferencia = ToDouble($get("TxtImporteTransferencia").value);
let TotalOtrosContado = 0;
let total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia + TotalOtrosContado;
if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) {
let totalAnticipos = ToDouble($get("TxtNCDev").value);
total = total + totalAnticipos;
function impresionBase64(pdfBase64) {
printJS({ printable: pdfBase64, type: 'pdf', showModal: true, base64: true });
}
let totalVenta = ToDouble($get('HdnTotal').value);// - ToDouble($get('HdnTotal').value);
function CalculaTotalPagoContado() {
let totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
let totalCredito = ToDouble($get("TxtImporteCredito").value);
let totalDebito = ToDouble($get("TxtImporteDebito").value);
let totalCheque = ToDouble($get("TxtImporteCheque").value);
let totalTransferencia = ToDouble($get("TxtImporteTransferencia").value);
let TotalOtrosContado = 0;
if (total > totalVenta) {
lblCambio.innerHTML = "Cambio:";
//HdnCambioFaltante.value = "1";
$get("TxtCambio").value = FormatoNumero(total - totalVenta);
} else {
lblCambio.innerHTML = "Faltante:";
//HdnCambioFaltante.value = "0";
$get("TxtCambio").value = FormatoNumero(total - totalVenta, 2);
let total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia;
if (<%= If(UsuarioActual.Empresa.CveEmpresa = 189, 1, 0)%> == 1) {
let totalAnticipos = ToDouble($get("TxtNCDev").value);
TotalOtrosContado = ToDouble($get("TxtImporteOtrosContado").value);
total = total + totalAnticipos + TotalOtrosContado;
}
let totalVenta = ToDouble($get('HdnTotal').value);// - ToDouble($get('HdnTotal').value);
if (total > totalVenta) {
lblCambio.innerHTML = "Cambio:";
//HdnCambioFaltante.value = "1";
$get("TxtCambio").value = FormatoNumero(total - totalVenta);
} else {
lblCambio.innerHTML = "Faltante:";
//HdnCambioFaltante.value = "0";
$get("TxtCambio").value = FormatoNumero(total - totalVenta, 2);
}
$get("TxtImporteContado").value = FormatoNumero(total, 2);
}
$get("TxtImporteContado").value = FormatoNumero(total, 2);
}
function CalculaDiferencia() {
let total = 0;
total = ToDouble($('#C_TxtEfectivoEnCaja').val()) - ToDouble($('#C_LblEfectivoEsperado').text());
$('#C_LblDiferenciaCaja').text(FormatoNumero(total));
}
function CalculaDiferencia() {
let total = 0;
total = ToDouble($('#C_TxtEfectivoEnCaja').val()) - ToDouble($('#C_LblEfectivoEsperado').text());
$('#C_LblDiferenciaCaja').text(FormatoNumero(total));
}
function CalculaDiferenciaBloqueo() {
let total = 0;
total = ToDouble($('#C_TxtEfectivoCajaBloqueo').val()) - ToDouble($('#C_LblEfectivoBloqueo').text());
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
}
function CalculaDiferenciaBloqueo() {
let total = 0;
total = ToDouble($('#C_TxtEfectivoCajaBloqueo').val()) - ToDouble($('#C_LblEfectivoBloqueo').text());
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
}

View File

@@ -109,6 +109,8 @@ Partial Class Ventas_PVCobranza
If UsuarioActual.CveEmpresa = 189 Then
DivDatosCheque.Visible = True
UpContadoOtros.Visible = True
UpContadoOtros.Update()
End If
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
@@ -458,7 +460,7 @@ Partial Class Ventas_PVCobranza
If VentaContado Then
'validaciones
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal + TxtNCDev.Text.ToDecimal()
Dim Pagado As Decimal = TxtImporteEfectivo.Text.ToDecimal + TxtImporteCredito.Text.ToDecimal + TxtImporteDebito.Text.ToDecimal + TxtImporteCheque.Text.ToDecimal + TxtImporteTransferencia.Text.ToDecimal + TxtNCDev.Text.ToDecimal() + TxtImporteOtrosContado.Text.ToDecimal()
If Pagado = 0 Then
Alert("Favor de especificar importe", TipoMensaje.ToastAdventencia)
Exit Sub
@@ -485,6 +487,18 @@ Partial Class Ventas_PVCobranza
Exit Sub
End If
End If
If TxtImporteOtrosContado.Text.ToDecimal() > 0 Then
If DdlOtroFormaPago.SelectedValue.ToEntero() <= 0 Then
Alert("Es necesario especificar la forma de pago adicional", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DdlCuentaOtrosContado.SelectedValue.ToEntero() <= 0 Then
Alert("Es necesario especificar la cuenta de la forma de pago adicional", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
Dim tCveCorte As Integer = CveCorte
@@ -626,6 +640,23 @@ Partial Class Ventas_PVCobranza
PagoAplicado += TxtImporteTransferencia.Text.ToDecimal
End If
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteOtrosContado.Text.ToDecimal > 0 Then
Dim CveConceptroOtros As Integer = -1
Select Case DdlOtroFormaPago.SelectedValue
Case "1" 'Debito
CveConceptroOtros = 11
Case "2" 'Crédito
CveConceptroOtros = 12
Case "3" 'Transferencia
CveConceptroOtros = 8
End Select
MsgError = RegistraIE(CveConceptroOtros, DdlCuentaOtrosContado.SelectedValue.ToEntero, TxtImporteOtrosContado.Text.ToDecimal, Fecha, CvePrePoliza, VentaActual, ObjIE, ObjConta, ObjVentas2, tCveCorte, CveSubProyecto:=VentaActual.CveSubProyecto)
SaldoPendiente -= TxtImporteOtrosContado.Text.ToDecimal
PagoAplicado += TxtImporteOtrosContado.Text.ToDecimal
End If
If MsgError = "" AndAlso SaldoPendiente > 0 AndAlso TxtImporteEfectivo.Text.ToDecimal > 0 Then
Dim PagoEfectivo As Decimal = TxtImporteEfectivo.Text.ToDecimal
@@ -2034,4 +2065,23 @@ Partial Class Ventas_PVCobranza
End If
End Sub
Protected Sub DdlOtroFormaPago_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim DtCC As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa)
Dim CveMon As Integer = 1
If DdlOtroFormaPago.SelectedValue.Contiene("1", "2") Then
DdlCuentaOtrosContado.dataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", CveMon))
ElseIf DdlOtroFormaPago.SelectedValue.Contiene("3") Then
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.CveEmpresa.Contiene(195, 197) Then
DdlCuentaOtrosContado.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1", If(CveMon <= 0, 1, CveMon)))
Else
DdlCuentaOtrosContado.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", If(CveMon <= 0, 1, CveMon)))
End If
End If
DdlCuentaOtrosContado.DataBind()
UpContadoOtros.Update()
End Sub
End Class

View File

@@ -405,9 +405,9 @@
</li>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
<asp:PostBackTrigger ControlID="LnkImprimirFormatoCicovisa" />
<asp:PostBackTrigger ControlID="LnkImprimirFormatoTelcel" />
<asp:PostBackTrigger ControlID="LnkImprimirFormatoTelcel" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
@@ -944,7 +944,7 @@
<asp:Label ID="LblMotivoCancelacion" runat="server"></asp:Label>
</td>
</tr>
</tr>
<tr align="left">
<td><b>Se timbró:</b>&nbsp;</td>
<td>
@@ -1094,8 +1094,8 @@
<asp:Label runat="server" ID="LblProyectoHeader" Text="" />
<asp:Label runat="server" ID="LblSubProyecto" Text="" /></th>
<th>P.U.&nbsp;<asp:LinkButton ID="ImgDescPU" runat="server" Text="<i class='fa fa-comment-o'></i>" Style="cursor: pointer;" AlternateText="Agregar Descuento" Visible="false" /></th>
<th runat="server" visible="false" id="thCosto2">
Costo <br />
<th runat="server" visible="false" id="thCosto2">Costo
<br />
Utilidad
</th>
<th id="thEncDesc1" runat="server" visible="true">Desc
@@ -1413,7 +1413,7 @@
</EditItemTemplate>
</asp:TemplateField>
<%--10--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right" Visible="false" ItemStyle-Width="20px" >
<asp:TemplateField ItemStyle-HorizontalAlign="Right" Visible="false" ItemStyle-Width="20px">
<ItemTemplate>
<asp:Label ID="LblCosto" runat="server"></asp:Label><br />
<asp:Label ID="LblCostoPorcentaje" runat="server"></asp:Label>
@@ -1971,23 +1971,23 @@
<asp:Literal ID="LtlPS" runat="server" Text='<%# Eval("CodigoPS") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Serie" visible="false">
<asp:TemplateField HeaderText="Serie" Visible="false">
<ItemTemplate>
<asp:Literal ID="LtlSerie" Text='<%# Eval("Serie") %>' Visible="false" runat="server" />
<asp:TextBox ID="TxtSerie" AutoPostBack="false" Text='<%# Eval("Serie") %>' Visible="false" runat="server" />
<asp:Button Text="" ID="BtnSerie" Style="display: none;" OnClick="BtnSerie_Click" runat="server" />
<asp:HiddenField runat="server" Value='<%# Eval("Serie") %>' ID="HdnSerie" />
<asp:HiddenField runat="server" Value='<%# Eval("Serie") %>' ID="HdnSerie" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Lote" HeaderText="Lote" Visible="False" />
<asp:BoundField DataField="Lote" HeaderText="Lote" Visible="False" />
<asp:BoundField DataField="FechaCaducidad" HeaderText="F. Caducidad" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField HeaderText="Lote/Caducidad" ItemStyle-HorizontalAlign="Left" Visible="false" ItemStyle-Width="270px">
<ItemTemplate>
<asp:DropDownList ID="DdlCaducidadProducto" CssClass="select2me" Width="100%" runat="server" Visible="false" CausesValidation="true" >
<asp:ListItem Selected="True" Text="-" Value="|"></asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Lote/Caducidad" ItemStyle-HorizontalAlign="Left" Visible="false" ItemStyle-Width="270px">
<ItemTemplate>
<asp:DropDownList ID="DdlCaducidadProducto" CssClass="select2me" Width="100%" runat="server" Visible="false" CausesValidation="true">
<asp:ListItem Selected="True" Text="-" Value="|"></asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
@@ -8207,7 +8207,7 @@
</div>
<div class="modal-body">
<div class="row" style="padding-left: 16px;">
<div class="col-md-8">
<div id="DivValidaRFC" runat="server" visible="false" class="col-md-8">
<div class="row">
<asp:Panel ID="PnlRFCCliente" runat="server" DefaultButton="BtnValidarRFC">
<div class="form-group form-md-line-input input-iconright col-xs-9">
@@ -8221,6 +8221,46 @@
</asp:Panel>
</div>
</div>
<div id="DivValidaPorNombre" runat="server" visible="false" class="col-md-8">
<div class="row">
<asp:Panel ID="PnlValidaNombre" runat="server" DefaultButton="BtnValidaPorNombre">
<div class="form-group form-md-line-input input-iconright col-xs-9">
<asp:TextBox ID="TxtRFCNombre" Style="text-transform: uppercase;" placeholder="Ingrese el RFC/Nombre para su validación" runat="server" CssClass="form-control" MaxLength="13" CausesValidation="true"></asp:TextBox>
<label for="<%= TxtRFCNombre.ClientID.ToString()%>">RFC / Nombre:</label>
</div>
<div class="form-group form-md-line-input input-iconright col-xs-3">
<asp:Button ID="BtnValidaPorNombre" runat="server" CssClass="btn btn-success" Text="Consultar" />
</div>
</asp:Panel>
</div>
</div>
<div id="DivBusquedaCliente" runat="server" visible="false" >
<div style="overflow-y: auto; width: 100%; height: 250px;">
<asp:GridView ID="GvBusquedaCliente" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron registros"
CssClass="ScrollAD table table-smallpadding Widthall" GridLines="None">
<Columns>
<asp:TemplateField ItemStyle-Width="15%">
<HeaderTemplate>Código</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlCodigo" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-CssClass="truncate" ItemStyle-Width="55%">
<HeaderTemplate>Nombre</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlNombre" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="30%">
<HeaderTemplate>RFC</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlRFC" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
<div class="col-md-4">
<div runat="server" id="DivTipoPersona" visible="false" class="form-group form-md-line-input input-iconright">
<asp:RadioButtonList runat="server" ID="RdTipoPersona" RepeatDirection="Horizontal" OnSelectedIndexChanged="RdTipoPersona_SelectedIndexChanged" AutoPostBack="true" CssClass="form-control">

View File

@@ -5469,7 +5469,11 @@ Partial Class Ventas
HplPagado.Text = "<b>CANCELADO<b>"
End If
If ViewState("CveCotizacion") IsNot Nothing AndAlso ViewState("CveCotizacion").ToString().ToEntero() > 0 AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
ImgAntiPend.Visible = True
If UsuarioActual.CveEmpresa = 189 Then
ImgAntiPend.Visible = False
Else
ImgAntiPend.Visible = True
End If
Else
ImgAntiPend.Visible = False
End If
@@ -5578,7 +5582,11 @@ Partial Class Ventas
If DbRowVenta("Saldo").ToString().ToDouble < 0.01 Then
If ViewState("CveCotizacion") IsNot Nothing AndAlso ViewState("CveCotizacion").ToString().ToEntero() > 0 AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then
ImgAntiPend.Visible = True
If UsuarioActual.CveEmpresa = 189 Then
ImgAntiPend.Visible = False
Else
ImgAntiPend.Visible = True
End If
Else
ImgAntiPend.Visible = False
End If
@@ -8738,12 +8746,16 @@ Partial Class Ventas
e.Row.FCDropDownList("DdlPrecioListaEdit").DataSource = Dt
End If
End Using
ElseIf DdlTipoComprobante.SelectedValue = "Ant" Then
e.Row.FCHtmlGenericControl("DivPrecioLista").Visible = False
End If
End If
e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind()
e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista"))
If e.Row.FCHtmlGenericControl("DivPrecioLista").Visible Then
e.Row.FCDropDownList("DdlPrecioListaEdit").DataBind()
e.Row.FCDropDownList("DdlPrecioListaEdit").SelectedValueExist(e.Row.DBCampo("CvePrecioLista"))
End If
End If
'Si es facturacion de OC o Contrato
@@ -9343,17 +9355,47 @@ Partial Class Ventas
NumTurnos = GvPS.Rows(e.RowIndex).FCTextBox("TxtNumTurnosEditar").Text.ToDecimal()
End If
DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero()).FiltroPrimero("") ' Estado = -1
If UsuarioActual.Empresa.Funcionalidad(601) = "1" Then 'valida anticipo que tenga conceptos válidos
If DdlTipoComprobante.SelectedValue = "Ant" Then
Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString
If PSCodigoSAT <> "84111506" Then
Alert($"El producto y/o servicio no es válido para generar anticipos.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
If DdlTipoComprobante.SelectedValue = "Cot" Then
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
End If
TmpDT.Rows.Remove(TmpDT.Rows(e.RowIndex))
CalculaUsados()
Dim CvePrecioLista As Integer = -1
Dim PrecioLista As String = ""
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
CvePrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedValue.ToEntero()
If UsuarioActual.CveEmpresa = 189 Then
PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text.Split("-"c)(0)
If GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem IsNot Nothing Then
Dim listaPL = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text.Split("-"c)
If listaPL.Count() > 0 Then
PrecioLista = listaPL(0)
End If
End If
Else
PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text
If GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem IsNot Nothing Then
PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text
End If
End If
End If
@@ -9453,7 +9495,9 @@ Partial Class Ventas
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
CvePrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedValue.ToEntero()
PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text
If GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem IsNot Nothing Then
PrecioLista = GvPS.Rows(e.RowIndex).FCDropDownList("DdlPrecioListaEdit").SelectedItem.Text
End If
TmpDT.Rows(e.RowIndex)("CvePrecioLista") = CvePrecioLista
TmpDT.Rows(e.RowIndex)("PrecioLista") = PrecioLista
@@ -17301,6 +17345,10 @@ Partial Class Ventas
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DtMovtos IsNot Nothing AndAlso DtMovtos.Rows.Count = 0 Then
ImgAntiPend.Visible = False
End If
If UsuarioActual.CveEmpresa = 189 Then
ImgAntiPend.Visible = False
End If
Else
GVAnticipos.DataSource = Nothing
End If
@@ -18716,7 +18764,13 @@ Partial Class Ventas
Protected Sub DdlPSEdit_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
If UsuarioActual.Empresa.Funcionalidad(109) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
If GvPS.EditIndex >= 0 Then
Dim EditarPrecio As Boolean = True
If DdlTipoComprobante.SelectedValue = "Ant" AndAlso UsuarioActual.CveEmpresa = 189 Then
EditarPrecio = False
End If
If GvPS.EditIndex >= 0 AndAlso EditarPrecio Then
Dim ddlPSEdit = DirectCast(sender, ADServerControl.Dropdownlost)
Dim GvRow = DirectCast(ddlPSEdit.NamingContainer, GridViewRow)
@@ -18963,6 +19017,9 @@ Partial Class Ventas
ImgAntiPend.Visible = True
End If
If UsuarioActual.CveEmpresa = 189 Then
ImgAntiPend.Visible = False
End If
If ImgAntiPend.Visible Then
If Me.TmpDTAnticiposNCIxCCliente IsNot Nothing Then
@@ -19008,6 +19065,10 @@ Partial Class Ventas
ImgAntiPend.Visible = True
End If
If UsuarioActual.CveEmpresa = 189 Then
ImgAntiPend.Visible = False
End If
If ImgAntiPend.Visible Then
If Me.TmpDTAnticiposNCIxCCliente IsNot Nothing Then
Dim DtMovtos As DataTable = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"Saldo > 0 And SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo IN('NC','RNC','IxC','Ant') ", "")}")
@@ -19493,11 +19554,6 @@ Partial Class Ventas
Return False
End If
If PU <= 0 Then
Alert("No se puede vender a un importe de cero", TipoMensaje.MsgAdvertencia)
Return False
End If
Dim PrecioLibre As Boolean = False
@@ -19505,13 +19561,6 @@ Partial Class Ventas
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DatarowPS IsNot Nothing Then
If DdlTipoComprobante.SelectedValue = "Cot" Then
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
Return False
End If
End If
If DdlTipoComprobante.SelectedValue = "Ant" Then
Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString
If PSCodigoSAT <> "84111506" Then
@@ -19520,11 +19569,23 @@ Partial Class Ventas
End If
End If
If DdlTipoComprobante.SelectedValue = "Cot" Then
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
Return False
End If
End If
PrecioLibre = CBool(DatarowPS("PrecioLibre"))
End If
End If
If PU <= 0 Then
Alert("No se puede vender a un importe de cero", TipoMensaje.MsgAdvertencia)
Return False
End If
'SI NO VIENE DESDE EL MODAL
If CantidadModal = 0 Then
If TxtCantidad.Text.ToDecimal() <= 0 Then
@@ -19892,7 +19953,7 @@ Partial Class Ventas
Descuento = Descuento + ((PU * PromocionPorcentaje / 100) * Cantidad)
End If
ElseIf TipoPromo = 3 Then 'Promocion por Cantidad
If Cantidad >= CantMinima Then
If Cantidad >= CantMinima Then
Descuento = Descuento + TotalPromocion
Else
CvePromocionDetalle = -1
@@ -23985,7 +24046,7 @@ Partial Class Ventas
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,
Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1),
PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(),
PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim.ToUpper(), CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(),
CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(), TipoDocto:=DdlTipoComprobante.SelectedValue, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal,
OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, Kilometraje:=TxtKilometraje.Text.ToDecimal, CveUsoCFDi:=DdlUsoCFDI.SelectedValue.ToEntero(),
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), ServicioDomicilio:=TrServicioDomicilio.Visible, CveMedico:=DdlMedico.SelectedValue.ToEntero, CveProcedimiento:=DdlProcedimiento.SelectedValue.ToEntero,
@@ -25204,17 +25265,71 @@ Partial Class Ventas
DivFormaCliente.Visible = False
divRegimenCliente.Visible = False
divGiro.Visible = False
UpAgregarCliente.Update()
DivBusquedaCliente.Visible = False
CargaEstados()
TxtRFCCliente.Focus()
If UsuarioActual.CveEmpresa = 189 Then
TxtRFCNombre.Text = ""
DivValidaRFC.Visible = False
DivValidaPorNombre.Visible = True
CargaGiro()
TxtRFCNombre.Focus()
Else
DivValidaRFC.Visible = True
DivValidaPorNombre.Visible = False
TxtRFCCliente.Focus()
End If
UpAgregarCliente.Update()
RegistraScript("showDivEC();")
End Sub
Protected Sub GvBusquedaCliente_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBusquedaCliente.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
Dim Liga As String = String.Format("<a href='javascript:CargaCliente(""{0}"");$(""#divAgregarCliente"").modal(""hide""); '>", e.Row.DBCampo("CveCliente"))
e.Row.FCLiteral("LtlCodigo").Text = String.Format("<div class='truncate'>{0}{1}</a></div>", Liga, e.Row.DBCampo("Codigo"))
e.Row.FCLiteral("LtlNombre").Text = String.Format("<div class='truncate'>{0}{1}</a></div>", Liga, e.Row.DBCampo("NombreComercial"))
e.Row.FCLiteral("LtlRFC").Text = String.Format("<div class='truncate'>{0}{1}</a></div>", Liga, e.Row.DBCampo("RFC"))
End If
End Sub
Private Sub BtnValidaPorNombre_Click(sender As Object, e As EventArgs) Handles BtnValidaPorNombre.Click
Dim ObjCliente As New ClsClientes
If ObjCliente.BuscarClienteRFCNombre(TxtRFCNombre.Text, UsuarioActual.CveEmpresa) Then
If ObjCliente.DtResultados.Rows.Count = 1 AndAlso TxtRFCNombre.Text.Trim() <> "XAXX010101000" Then
RegistraScript("hideDivEC();")
ViewState("CveCliente") = ObjCliente.DtResultados(0)("CveCliente").ToString().ToEntero()
HdnCveCliente.Value = ObjCliente.DtResultados(0)("CveCliente").ToString()
CargaCliente(CveCliente)
UpCliente.Update()
ElseIf ObjCliente.DtResultados.Rows.Count > 0 AndAlso TxtRFCNombre.Text.Trim() <> "XAXX010101000" Then
DivBusquedaCliente.Visible = True
GvBusquedaCliente.DataSource = ObjCliente.DtResultados
GvBusquedaCliente.DataBind()
Else
DivValidaRFC.Visible = True
DivValidaPorNombre.Visible = False
DivBusquedaCliente.Visible = False
TxtRFCCliente.Text = TxtRFCNombre.Text
BtnValidarRFC_Click(Nothing, EventArgs.Empty)
End If
End If
ObjCliente.Dispose()
UpAgregarCliente.Update()
End Sub
Private Sub BtnValidarRFC_Click(sender As Object, e As EventArgs) Handles BtnValidarRFC.Click
If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then
@@ -25291,6 +25406,21 @@ Partial Class Ventas
If UsuarioActual.CveEmpresa = 189 Then
divGiro.Visible = True
Dim DrSP As DataRow = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, DdlSubProyectoDatos.SelectedValue.ToEntero()).FiltroPrimero("")
If DrSP IsNot Nothing Then
DdlEstadoSAT.SelectedValueExist(DrSP("CveEstado").ToString())
TxtCiudadCliente.Text = DrSP("Municipio").ToString()
TxtLocalidadCliente.Text = DrSP("Localidad").ToString()
TxtColoniaCliente.Text = DrSP("Colonia").ToString()
TxtCPCliente.Text = DrSP("CP").ToString()
TxtDireccionCliente.Text = DrSP("Calle").ToString()
TxtNumExtCliente.Text = DrSP("NoExt").ToString()
TxtNumIntCliente.Text = DrSP("NoInt").ToString()
End If
End If
End Sub
@@ -26751,16 +26881,21 @@ Partial Class Ventas
Dim GenerarDevolucionAnticipada As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso ObjFacturaCancelacion.TipoDocto.Contiene("Ing", "Rem") AndAlso Not EsRefacturacion AndAlso ObjFacturaCancelacion.Pagado > 0 Then
CancelacionPagos = OpcionesCancelacionPagos.ConPagos_GenerarIxC
End If
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso ObjFacturaCancelacion.TipoDocto.Contiene("Ing", "Rem") AndAlso Not EsRefacturacion Then
If ChkDevAlm.Checked Then
GenerarDevolucionAnticipada = True
End If
For Each Gvr As GridViewRow In GvCancelarRemisiones.Rows
ListaRemisionesCancelar.Add(Gvr.DataKey("CveVenta").ToEntero())
Next
If ObjFacturaCancelacion.TipoDocto.Contiene("Ing") Then
For Each Gvr As GridViewRow In GvCancelarRemisiones.Rows
ListaRemisionesCancelar.Add(Gvr.DataKey("CveVenta").ToEntero())
Next
End If
CancelacionPagos = OpcionesCancelacionPagos.ConPagos_GenerarIxC
End If
resp = ObjFacturaCancelacion.CancelarFactura(If(ChkDevAlm.Checked, 1, 0), ListaRemisionesCancelar, CveMotivoCancelacion:=DdlMotivoCancelacion.SelectedValue.ToEntero(), Motivo:=TxtMotivoCancelacion.Text.Trim(), CveEstadoCancelacion:=Me.CveEstadoCancelacion, ForzarDevolucion:=GenerarDevolucionAnticipada, CancelacionPagos:=CancelacionPagos)
@@ -32655,6 +32790,10 @@ Partial Class Ventas
GVAnticipos.DataSource = DtMovtos
GVAnticipos.DataBind()
If DtMovtos.Rows.Count > 0 Then ImgAntiPend.Visible = True
If UsuarioActual.CveEmpresa = 189 Then
ImgAntiPend.Visible = False
End If
Else
Dim DtMovtos As DataTable = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"Saldo > 0 AND SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo = 'Ant' ", "")} {If(DdlTipoComprobante.SelectedValue = "Ant", "AND Tipo = 'NC'", "")}")
divAmortizacionTipoRelacion.Visible = True
@@ -32948,7 +33087,7 @@ Partial Class Ventas
Moneda, TipoCambio, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim,
UsuarioActual.CveEmpresa, CveVenta,
Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1),
PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(), CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(),
PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim.ToUpper(), CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(), CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(),
CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal,
TipoDocto:=DdlTipoComprobante.SelectedValue, Kilometraje:=TxtKilometraje.Text.ToDecimal, CveUsoCFDi:=DdlUsoCFDI.SelectedValue.ToEntero(), CveVendedor:=DdlVendedor.SelectedValue.ToEntero()) Then
MensajeError = "Ocurrió un error al actualizar la información de la cotización"