Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -4512,7 +4512,7 @@ Namespace Modelos
|
||||
Private Function GeneraMovimientosVirtuales(CveVenta As Integer, ByRef ObjInventario As ClsInventarios) As Boolean
|
||||
Dim ErrorCancelar As Boolean = False
|
||||
Try
|
||||
If UsuarioActual.CveEmpresa = 140 Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
Dim CveMovimientoSalida As Integer = -1
|
||||
Dim CveAlmacenVirutal As Integer = -1
|
||||
|
||||
@@ -4535,7 +4535,7 @@ Namespace Modelos
|
||||
End If
|
||||
|
||||
If DtMovtosDev IsNot Nothing AndAlso DtMovtosDev.Rows.Count > 0 Then
|
||||
Dim CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenVirutal, 18, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1)
|
||||
Dim CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenVirutal, 18, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, CveMovimientoRelacionado:=CveMovimientoSalida)
|
||||
|
||||
For Each RowUsado As DataRow In DtMovtosDev.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -418,7 +418,7 @@
|
||||
|
||||
<%--GV DATOS--%>
|
||||
<asp:GridView ID="GvDatos" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False" ShowFooter="True" ShowHeader="true" ShowHeaderWhenEmpty="True"
|
||||
DataKeyNames="Consec,CvePS,Codigo,CodigoBarras,AplicaSerieLote,CveUM,CantidadC,CantidadF,UM,PS,CveClasificacion,CveVentaDetalle,CveTamaño,PUVenta" HeaderStyle-CssClass="Titulos" RowStyle-Height="25px" CssClass="table table-striped table-hover Widthall ScrollAD gvInventario mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None">
|
||||
DataKeyNames="Consec,CvePS,Codigo,CodigoBarras,AplicaSerieLote,CveUM,CantidadC,CantidadF,UM,PS,CveClasificacion,CveVentaDetalle,CveTamaño" HeaderStyle-CssClass="Titulos" RowStyle-Height="25px" CssClass="table table-striped table-hover Widthall ScrollAD gvInventario mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None">
|
||||
<HeaderStyle Height="58px" />
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
|
||||
@@ -1584,32 +1584,6 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Try
|
||||
'VALIDA EXISTENCIA 2
|
||||
If TipoMovimiento = 1 Then
|
||||
|
||||
'For Each Dr As DataRow In DtDatos.Rows
|
||||
' If Dr("CantidadGV").ToString.ToDecimal > 0 Then
|
||||
' If Dr("Inv_CveMetodoInventario").ToString = "5" Then
|
||||
' DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
|
||||
' For Each Dr1 As DataRow In DtDetalle.Rows
|
||||
' If Not ObjInventario.GetExistenciasPS(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=Dr1("SerieLote").ToString, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1) >= 1 Then
|
||||
' TextoError += String.Format(" - <b>{0}</b> Serie: <b>{1}</b> <br/>", Dr("PS"), Dr1("SerieLote"))
|
||||
' End If
|
||||
' Next
|
||||
' ElseIf Dr("Inv_CveMetodoInventario").ToString = "6" Then
|
||||
' DtDetalle = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
|
||||
' For Each Dr1 As DataRow In DtDetalle.Rows
|
||||
' If Not ObjInventario.GetExistenciasPS(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1) >= DtDatosDetalleLote.SUM("Cantidad", $"Lote = '{Dr1("Lote").ToString}' AND Batch = '{Dr1("Batch").ToString}'") Then
|
||||
' TextoError += String.Format(" - <b>{0}</b> Lote: <b>{1}</b> Batch: <b>{2}</b> <br/>", Dr("PS"), Dr1("Lote"), Dr1("Batch"))
|
||||
' End If
|
||||
' Next
|
||||
' Else
|
||||
'If Not ObjInventario.GetExistenciasPS(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1) >= Dr("CantidadGV").ToString.ToDecimal Then
|
||||
' TextoError += String.Format(" - {0} <br/>", Dr("PS"))
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' End If
|
||||
'Next
|
||||
|
||||
Dim StrXML As New StringBuilder
|
||||
StrXML.Append("<conceptos>")
|
||||
For Each Dr As DataRow In DtDatos.Rows
|
||||
@@ -1631,11 +1605,6 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Next
|
||||
StrXML.Append("</conceptos>")
|
||||
|
||||
'Alert(StrXML.ToString())
|
||||
'ObjInventario.RollBack()
|
||||
'ObjInventario.Dispose()
|
||||
'Exit Sub
|
||||
|
||||
Dim TieneErrorExistencia = False
|
||||
If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero, TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
@@ -1661,45 +1630,6 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Else
|
||||
'If Not UsuarioActual.TienePermisoProceso(223) Then 'INVALIDA LA VALIDACION DE EXISTENCIA DE LA VENTA ORIGINAL
|
||||
' If DtExistencias IsNot Nothing Then
|
||||
' For Each Dr As DataRow In DtDatos.Rows
|
||||
' If Dr("CantidadGV").ToString.ToDecimal > 0 Then
|
||||
|
||||
' If Dr("Inv_CveMetodoInventario").ToString = "5" Then
|
||||
' DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
|
||||
' For Each Dr1 As DataRow In DtDetalle.Rows
|
||||
' If Not DtExistencias.SUM("Cantidad", $"CvePS = {Dr1("CvePS").ToString.ToEntero} AND CveUM = {Dr1("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'") >= 1 Then
|
||||
' TextoError += String.Format("<b> - {0}</b> <br/>", Dr1("PS"))
|
||||
' End If
|
||||
' Next
|
||||
' ElseIf Dr("Inv_CveMetodoInventario").ToString = "6" Then
|
||||
' DtDetalle = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec")))
|
||||
' For Each Dr1 As DataRow In DtDetalle.Rows
|
||||
' If Not DtExistencias.SUM("Cantidad", $"CvePS = {Dr1("CvePS").ToString.ToEntero} AND CveUM = {Dr1("CveUM").ToString.ToEntero} AND Lote = '{Dr1("Lote").ToString}' AND Batch = '{Dr1("Batch").ToString}'") >= DtDatosDetalleLote.SUM("Cantidad", $"Lote = '{Dr1("Lote").ToString}' AND Batch = '{Dr1("Batch").ToString}'") Then
|
||||
' TextoError += String.Format("<b> - {0}</b> <br/>", Dr1("PS"))
|
||||
' End If
|
||||
' Next
|
||||
' Else
|
||||
' If Not DtExistencias.SUM("Cantidad", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}") >= Dr("CantidadGV").ToString.ToDecimal Then
|
||||
' TextoError += String.Format("<b> - {0}</b> <br/>", Dr("PS"))
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
' If TextoError <> "" Then
|
||||
' Alert($" Lo(s) siguiente(s) Productos <b>no tienen</b> existencia suficiente:<br/><br/> {TextoError}", TipoMensaje.MsgAdvertencia)
|
||||
' RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
||||
' ObjInventario.RollBack()
|
||||
' ObjInventario.Dispose()
|
||||
' ObjConta.Dispose()
|
||||
' ObjVentas.Dispose()
|
||||
' ObjEventos.Dispose()
|
||||
' Exit Sub
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
End If
|
||||
|
||||
'' TERMINA: VALIDACIONES
|
||||
@@ -1901,7 +1831,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
'' TERMINA: APARTADOS
|
||||
|
||||
' COMIENZA: GARANTIAS
|
||||
If TipoDocto.Contiene("Ing", "Rem") AndAlso UsuarioActual.CveEmpresa = 140 AndAlso TipoMovimiento = 1 Then
|
||||
If TipoDocto.Contiene("Ing", "Rem") AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso TipoMovimiento = 1 Then
|
||||
|
||||
Dim CveAlmacenGarantia As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 6).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
Dim DtGarantias As DataTable = Nothing
|
||||
@@ -1928,54 +1858,82 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
' TERMINA: GARANTIAS
|
||||
|
||||
|
||||
' COMIENZA: VIRTUAL
|
||||
If TipoDocto.Contiene("Ing", "Rem") AndAlso UsuarioActual.CveEmpresa = 140 Then
|
||||
If TipoDocto.Contiene("Ing") AndAlso UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
|
||||
Dim DtTamanios As New DataTable("DtTamanios")
|
||||
DtTamanios.Columns.Add(New DataColumn("CvePS", GetType(Integer)))
|
||||
DtTamanios.Columns.Add(New DataColumn("Cantidad", GetType(Decimal)))
|
||||
DtTamanios.Columns.Add(New DataColumn("PU", GetType(Decimal)))
|
||||
DtTamanios.Columns.Add(New DataColumn("CveUM", GetType(Integer)))
|
||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||
DtPSVirtual.Columns.Add(New DataColumn("CvePS", GetType(Integer)))
|
||||
DtPSVirtual.Columns.Add(New DataColumn("Cantidad", GetType(Decimal)))
|
||||
DtPSVirtual.Columns.Add(New DataColumn("PU", GetType(Decimal)))
|
||||
DtPSVirtual.Columns.Add(New DataColumn("CveUM", GetType(Integer)))
|
||||
|
||||
Dim DtTamanios As DataTable = Nothing
|
||||
|
||||
If ObjAcumuladores.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
|
||||
For Each GvRow As GridViewRow In GvDatos.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
For Each Tam As DataRow In ObjAcumuladores.DtResultados.Rows
|
||||
If Tam("CveTamaño").ToString() = GvRow.DataKey("CveTamaño") Then
|
||||
Dim Row As DataRow = DtTamanios.NewRow()
|
||||
|
||||
Row("CvePS") = Tam("CvePSCargo").ToString().ToEntero()
|
||||
Row("Cantidad") = GvRow.FCTextBox("TbCantidadF").Text.ToDecimal()
|
||||
Row("PU") = GvRow.DataKey("PUVenta").ToDecimal()
|
||||
Row("CveUM") = GvRow.DataKey("CveUM").ToEntero()
|
||||
|
||||
DtTamanios.Rows.Add(Row)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
DtTamanios = ObjAcumuladores.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
Dim CveAlmacenVirtual As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
Dim CveConceptoMovimientoVirtual As Integer = -1
|
||||
Dim CveAlmacenVirtual As Integer = -1
|
||||
Dim CveMovimientoRelacionadoVirtual As Integer = -1
|
||||
|
||||
If DtTamanios IsNot Nothing AndAlso DtTamanios.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 Then
|
||||
Dim CveConceptoMovimientoVirtual = If(TipoMovimiento = 1, 3, 18) 'CHECA SI ES ENTRADA O DEVOLUCION
|
||||
If TipoMovimiento = 1 Then
|
||||
For Each GvRow As GridViewRow In GvDatos.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
CveAlmacenVirutal = ObjInventario.AddMovimiento(CveAlmacenVirutal, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text)
|
||||
For Each Tam As DataRow In DtTamanios.Rows
|
||||
If Tam("CveTamaño").ToString() = GvRow.DataKey("CveTamaño") Then
|
||||
Dim CvePSCargo = Tam("CvePSCargo").ToString().ToEntero()
|
||||
Dim Row As DataRow = DtPSVirtual.NewRow()
|
||||
Row("CvePS") = CvePSCargo
|
||||
Row("Cantidad") = GvRow.FCTextBox("TbCantidadF").Text.ToDecimal()
|
||||
Row("PU") = 0
|
||||
Row("CveUM") = GvRow.DataKey("CveUM").ToEntero()
|
||||
|
||||
DtPSVirtual.Rows.Add(Row)
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
Next
|
||||
CveConceptoMovimientoVirtual = 3
|
||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
|
||||
ElseIf TipoMovimiento = 2 Then
|
||||
Dim CveMovimientoSalidaDev As Integer = -1
|
||||
If ObjInventario.GetInv_Mov(CveVentaSurtir, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND CveTipoAlmacen = 24 AND CveConcepto = 3 AND CveVenta > 0")
|
||||
CveMovimientoSalidaDev = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
||||
CveAlmacenVirtual = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||
CveMovimientoRelacionadoVirtual = CveMovimientoSalidaDev
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDev, UsuarioActual.CveEmpresa) Then
|
||||
DtPSVirtual = ObjInventario.DtResultados.Copy()
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
CveConceptoMovimientoVirtual = 18
|
||||
End If
|
||||
|
||||
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then
|
||||
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual)
|
||||
FolioVirtual = ObjInventario.Folio
|
||||
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
For Each RowUsado As DataRow In DtTamanios.Rows
|
||||
For Each RowUsado As DataRow In DtPSVirtual.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
Dim CantidadEntrada As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Double = RowUsado("PU").ToString().ToDouble()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveAlmacenVirutal, CantidadEntrada, CveUM, CvePS, PU, -1) Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar."
|
||||
Exit For
|
||||
@@ -1989,7 +1947,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
If DtTamanios.Rows.Count = 0 Then
|
||||
If DtPSVirtual.Rows.Count = 0 Then
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
End If
|
||||
@@ -2286,123 +2244,6 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
' SE REALIZARA AL MOMENTO DE CANCELAR LA FACTURA {
|
||||
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
|
||||
|
||||
'If Not ErrorMovInv And EsDevolucionVenta = 1 And TipoDocto = "Ing" Then
|
||||
' Dim DtDevRem As New DataTable
|
||||
' Dim DtMovtosDev As New DataTable
|
||||
' Dim CveAlmacenTraspasoDestinoDevRem = -1
|
||||
|
||||
' Dim CveVentaDetalleRem = -1
|
||||
' Dim CantidadDevolver As Decimal = 0
|
||||
' Dim CantidadRem As Decimal = 0
|
||||
|
||||
' 'CARGA REMISIONES DE LA VENTA DEVUELTA
|
||||
' If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then
|
||||
' DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen > 0")
|
||||
' Else
|
||||
' ErrorMovInv = True
|
||||
' End If
|
||||
|
||||
' 'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
|
||||
' If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||
' DtMovtosDev = ObjInventario.DtResultados
|
||||
' Else
|
||||
' ErrorMovInv = True
|
||||
' End If
|
||||
|
||||
' If Not ErrorMovInv Then
|
||||
' If DtDevRem.Rows.Count > 0 And DtMovtosDev.Rows.Count > 0 Then
|
||||
|
||||
' For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem", "CveAlmacenTraspasoDestino"}).Rows
|
||||
' CveAlmacenTraspasoDestinoDevRem = DrMovtos("CveAlmacenTraspasoDestino").ToString.ToEntero
|
||||
' If Not CveAlmacenTraspasoDestinoDevRem > 0 Then
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al obtener el almacén de devolucion de remisión."
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
' 'SALIDA GENERAL
|
||||
' CveMovimientoSalidaDevRem = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=CveAlmacenTraspasoDestinoDevRem)
|
||||
' FolioMovimientoSalidaDevRem = ObjInventario.Folio
|
||||
|
||||
' 'ENTRADA ADELANTADO
|
||||
' CveMovimientoEntradaDevRem = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestinoDevRem, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalidaDevRem, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero)
|
||||
' FolioMovimientoEntradaDevRem = ObjInventario.Folio
|
||||
|
||||
' If Not (CveMovimientoSalidaDevRem > 0 And CveMovimientoEntradaDevRem > 0) Then
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al generar los movimientos de devolución a remisión."
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
|
||||
' 'SALIDA POR TRAPASO DE GENERAL
|
||||
' For Each DrRem As DataRow In DtDevRem.FiltraParametros($"CveRem = {DrMovtos("CveRem")}").Rows
|
||||
' CveVentaDetalleRem = DrRem("CveVentaDetalleRem").ToString.ToEntero
|
||||
' CantidadRem = DrRem("CantidadFacturada").ToString.ToDecimal
|
||||
' 'CantidadDevolver = DtMovtosDev.FiltroPrimeroValor("Cantidad", $"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").ToDouble
|
||||
' 'If (Dr("Cantidad").ToString.ToDouble > CantidadRem, CantidadRem, Dr("Cantidad").ToString.ToDouble) Then
|
||||
|
||||
' If Not CveVentaDetalleRem > 0 Then
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al obtener la relación de la venta con la remisión."
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
' For Each Dr As DataRow In DtMovtosDev.FiltraParametros($"CveVentaDetalle = {DrRem("CveVentaDetalle").ToString.ToEntero}").Rows
|
||||
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDouble, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=CveVentaDetalleRem, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al guardar los movimientos de salida de traspaso de devolucion de remisión."
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' If ErrorMovInv Then
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' If ErrorMovInv Then
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
' 'ENTRADA POR TRAPASO A ENTREGA POR ADELANTADO
|
||||
' If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then
|
||||
' For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al guardar los movimientos de entrada de traspaso de devolucion de remisión."
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' If ErrorMovInv Then
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
' Else
|
||||
' ErrorMovInv = True
|
||||
' TextoError = "Ocurrió un error al obtener los detalles de la devolución de almacén"
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
|
||||
' If Not ObjVentas.UpdateVentasDevolucionAlmacen(0, DrMovtos("CveRem").ToString.ToEntero) Then
|
||||
' TextoError = "Ocurrió un error al hacer la devolucion hacia la remision. Por favor vuelva a intentar."
|
||||
' ErrorMovInv = True
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
' Next
|
||||
' End If
|
||||
' Else
|
||||
' TextoError = "Ocurrió un error al hacer la devolucion a remisión. Por favor vuelva a intentar."
|
||||
' ErrorMovInv = True
|
||||
' End If
|
||||
'End If
|
||||
'}
|
||||
|
||||
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
|
||||
If Not ErrorMovInv And EsDevolucionVenta = 1 Then
|
||||
@@ -2427,7 +2268,6 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
ErrorMovInv = True
|
||||
OnError("Ocurrió un error al guardar", ex)
|
||||
@@ -2441,16 +2281,11 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Msg.AppendFormat("Movimiento Salida: <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimiento, Folio)
|
||||
Msg.AppendFormat("<br/><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento)))
|
||||
|
||||
|
||||
'Msg.AppendFormat("<input type=""text"" id=""NumeroGuia""/>")
|
||||
'Dim script As String = "$('#TxtNumeroGuia').val($('#NumeroGuia').val());$('#BtnNumeroGuia').click();"
|
||||
|
||||
If CveMovimientoEntrada > 0 Then
|
||||
Msg.AppendFormat("<br/><br/> Movimiento Entrada (Traspaso): <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoEntrada, FolioEntrada)
|
||||
Msg.AppendFormat("<br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada)))
|
||||
End If
|
||||
|
||||
|
||||
If DtTraspasos.Rows.Count > 0 Then
|
||||
Msg.AppendFormat("<br/><br/> Movimientos de Control (Apartados):")
|
||||
For Each Dr As DataRow In DtTraspasos.Rows
|
||||
@@ -2463,20 +2298,12 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Msg.AppendFormat("<br/><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoGarantia)))
|
||||
End If
|
||||
|
||||
'VIRTUAL
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
Msg.AppendFormat("<br/> Movimiento de Salida del Almacen Virtal: ")
|
||||
Msg.AppendFormat("<b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoVirtual, FolioVirtual)
|
||||
Msg.AppendFormat("<br/><br/> Movimiento de Salida del Almacen Virtual: ")
|
||||
Msg.AppendFormat("<b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoVirtual, FolioVirtual)
|
||||
Msg.AppendFormat("<br/><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoVirtual)))
|
||||
End If
|
||||
|
||||
'If CveMovimientoSalidaDevRem > 0 Then
|
||||
' Msg.AppendFormat(" < br /<> br /> Movimiento de salida de devolución (Traspaso): <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoSalidaDevRem, FolioMovimientoSalidaDevRem)
|
||||
' Msg.AppendFormat("<br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalidaDevRem)))
|
||||
|
||||
' Msg.AppendFormat("<br/><br/> Movimiento de entrada de devolución (Traspaso): <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a></b>", CveMovimientoEntradaDevRem, FolioMovimientoEntradaDevRem)
|
||||
' Msg.AppendFormat("<br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntradaDevRem)))
|
||||
'End If
|
||||
|
||||
Alert(Msg.ToString, TipoMensaje.MsgInformacion)
|
||||
|
||||
Limpia()
|
||||
@@ -2492,6 +2319,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
ObjConta.Dispose()
|
||||
ObjVentas.Dispose()
|
||||
ObjEventos.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GuardaTraspaso()
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
<div class="row" id="DivFactura" runat="server" visible="false">
|
||||
<label class="col-md-1 truncate" style="width: 110px">Factura:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlFactura" AutoPostBack="true" runat="server" CssClass="form-control input-sm select2me" Style="max-width: 200px" DataTextField="SerieFolio" DataValueField="CveVenta" OnSelectedIndexChanged="DdlFactura_SelectedIndexChanged">
|
||||
<asp:DropDownList ID="DdlFactura" AutoPostBack="true" runat="server" CssClass="form-control input-sm select2me" Style="max-width: 200px" DataTextField="SerieFolio" DataValueField="CveVenta">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -879,7 +879,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
If Valido And AgregarUsado Then
|
||||
|
||||
If ObjFactura IsNot Nothing AndAlso Not EsDistribuidor Then
|
||||
If ObjFactura IsNot Nothing AndAlso Me.CveRemisionRecibida > 0 Then
|
||||
Dim RowDetalle As DataRow = ObjFactura.DtDetalle.FiltroPrimero($"CvePS={CvePS}")
|
||||
|
||||
If RowDetalle IsNot Nothing Then
|
||||
@@ -981,9 +981,18 @@ Partial Class Inventarios_RecepcionUsados
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
||||
If ObjRemisionNC IsNot Nothing Then
|
||||
|
||||
'SI ES DISTRIBUIDOR Y NO VIENE DE REMISION, GENERA UNA REMISION DE NOTA DE CREDITO
|
||||
If EsDistribuidor AndAlso Me.CveRemisionRecibida <= 0 Then
|
||||
Dim CveCliente As Integer = DdlClientes.SelectedValue.ToEntero()
|
||||
Dim CveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={DdlAlmacen.SelectedValue}").ToEntero
|
||||
|
||||
CreaRemisionNC(CveCliente, CveSubProyecto, 1)
|
||||
End If
|
||||
|
||||
If Me.ObjRemisionNC IsNot Nothing Then
|
||||
Dim sb As New StringBuilder()
|
||||
sb.Append($"Se va a generar un documento de tipo 'Remisión de nota de crédito'.<br> Serie-Folio:<b>{ObjRemisionNC.SerieFolio}</b>.<br> ¿Esta seguro que desea guardar?:<br/>")
|
||||
sb.Append($"Se va a generar un documento de tipo 'Remisión de nota de crédito'.<br> Serie-Folio:<b>{Me.ObjRemisionNC.SerieFolio}</b>.<br> ¿Esta seguro que desea guardar?:<br/>")
|
||||
|
||||
Alert(sb.ToString(), TipoMensaje.MsgConfirmacion, JSBtnAceptar:="GenerarRNC();", TextoConfirmacion:=" Si ", TextoCancelacion:=" No ")
|
||||
Else
|
||||
@@ -1030,8 +1039,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
If CveRemisionRecibida > 0 Then
|
||||
CveVenta = CveRemisionRecibida
|
||||
ElseIf DdlFactura.SelectedValue.ToEntero() > 0 Then
|
||||
CveVenta = DdlFactura.SelectedValue.ToEntero()
|
||||
End If
|
||||
|
||||
CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, CveConcepto, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta,
|
||||
@@ -1059,7 +1066,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If Not ObjVentas.UpdateVentaUsadoRecibido(CveRemisionRecibida, Dr("CvePS").ToString.ToEntero, True) Then
|
||||
If Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True) Then
|
||||
Mensaje = "Error al actualizar el recibo de los usados"
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
@@ -1067,10 +1074,10 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 2, 1, 2)
|
||||
|
||||
If RBLOpcion.SelectedValue.ToEntero <> 3 Then
|
||||
If RBLOpcion.SelectedValue.ToEntero <> 3 AndAlso Not GenerarRNC Then
|
||||
If EsDistribuidor Then
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, -1, UsuarioActual.CveUsuario,
|
||||
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then
|
||||
UsuarioActual.CveEmpresa, CveVenta, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then
|
||||
Mensaje = "Error al guardar Movimientos de distribuidor"
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
@@ -1712,7 +1719,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
UpGenerales.Update()
|
||||
End Sub
|
||||
Private Sub CargaFacturasCliente()
|
||||
DivFactura.Visible = True
|
||||
'DivFactura.Visible = True
|
||||
Dim CveCliente As Integer = DdlClientes.SelectedValue.ToEntero()
|
||||
If CveCliente > 0 Then
|
||||
|
||||
@@ -1952,14 +1959,31 @@ Partial Class Inventarios_RecepcionUsados
|
||||
CveCliente = ObjVentas.DtResultados.Rows(0)("CveCliente").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
'SI ES DISTRIBUIDOR VAMOS A GENERAR LA REMISION DE NOTA DE CREDITO
|
||||
If EsDistribuidor Then
|
||||
DivCliente.Visible = True
|
||||
DdlClientes.SelectedValueExist(CveCliente)
|
||||
DdlClientes_SelectedIndexChanged(DdlClientes, EventArgs.Empty)
|
||||
DdlFactura.SelectedValueExist(CveRemisionRecibida)
|
||||
|
||||
If Me.ObjRemisionNC IsNot Nothing Then
|
||||
Me.ObjRemisionNC.Dispose()
|
||||
Me.ObjRemisionNC = Nothing
|
||||
End If
|
||||
|
||||
If Me.ObjFactura IsNot Nothing Then
|
||||
Me.ObjFactura.Dispose()
|
||||
Me.ObjFactura = Nothing
|
||||
End If
|
||||
|
||||
Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=Server.MapPath("/"))
|
||||
|
||||
If Me.ObjFactura IsNot Nothing Then
|
||||
'CreaRemisionNC(ObjFactura.CveCliente, ObjFactura.CveSubProyecto, ObjFactura.CveMoneda)
|
||||
DivTotal.Visible = True
|
||||
End If
|
||||
Else
|
||||
DivCliente.Visible = False
|
||||
DivFactura.Visible = False
|
||||
'DivFactura.Visible = False
|
||||
End If
|
||||
|
||||
If ObjVentas.GetVentasUsadosDetalle(CveRemisionRecibida) Then
|
||||
@@ -1971,7 +1995,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
For Each RowUsado As DataRow In DtUsados.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
|
||||
Dim RowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0) '.FiltroPrimeroValor("CveTamaño", $"CvePS = { DdlProducto2.SelectedValue.ToEntero }").ToEntero
|
||||
Dim RowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0)
|
||||
Dim CveTamaño As Integer = RowPS("CveTamaño").ToString().ToEntero()
|
||||
|
||||
Dim PS As String = RowPS("PS").ToString()
|
||||
@@ -1988,36 +2012,36 @@ Partial Class Inventarios_RecepcionUsados
|
||||
UpGenerales.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlFactura_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
'Protected Sub DdlFactura_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
|
||||
If Not EsDistribuidor AndAlso Me.CveRemisionRecibida <= 0 Then
|
||||
' If EsDistribuidor AndAlso Me.CveRemisionRecibida <= 0 Then
|
||||
|
||||
If ObjRemisionNC IsNot Nothing Then
|
||||
ObjRemisionNC.Dispose()
|
||||
ObjRemisionNC = Nothing
|
||||
End If
|
||||
' If Me.ObjRemisionNC IsNot Nothing Then
|
||||
' Me.ObjRemisionNC.Dispose()
|
||||
' Me.ObjRemisionNC = Nothing
|
||||
' End If
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
ObjFactura.Dispose()
|
||||
ObjFactura = Nothing
|
||||
End If
|
||||
' If Me.ObjFactura IsNot Nothing Then
|
||||
' Me.ObjFactura.Dispose()
|
||||
' Me.ObjFactura = Nothing
|
||||
' End If
|
||||
|
||||
Dim CveVenta As Integer = DdlFactura.SelectedValue.ToEntero()
|
||||
' 'Dim CveVenta As Integer = DdlFactura.SelectedValue.ToEntero()
|
||||
|
||||
ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, DirectorioServidor:=Server.MapPath("/"))
|
||||
' 'ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, DirectorioServidor:=Server.MapPath("/"))
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
CreaRemisionNC(ObjFactura.CveCliente, ObjFactura.CveSubProyecto, ObjFactura.CveMoneda)
|
||||
DivTotal.Visible = True
|
||||
End If
|
||||
End If
|
||||
' If Me.ObjFactura IsNot Nothing Then
|
||||
' CreaRemisionNC(ObjFactura.CveCliente, ObjFactura.CveSubProyecto, ObjFactura.CveMoneda)
|
||||
' DivTotal.Visible = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
UPDatos.Update()
|
||||
' UPDatos.Update()
|
||||
|
||||
End Sub
|
||||
'End Sub
|
||||
|
||||
Private Sub CreaRemisionNC(CveCliente As Integer, CveSubProyecto As Integer, CveMoneda As Integer)
|
||||
ObjRemisionNC = New Modelos.Factura(UsuarioActual)
|
||||
Me.ObjRemisionNC = New Modelos.Factura(UsuarioActual)
|
||||
|
||||
Dim Folio As String = ""
|
||||
Dim Serie As String = ""
|
||||
@@ -2033,102 +2057,102 @@ Partial Class Inventarios_RecepcionUsados
|
||||
End If
|
||||
ObjFolios.Dispose()
|
||||
|
||||
ObjRemisionNC.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML
|
||||
ObjRemisionNC.Serie = Serie
|
||||
ObjRemisionNC.Folio = Folio.ToEntero()
|
||||
ObjRemisionNC.Version = "3.3"
|
||||
ObjRemisionNC.FolioFiscal = ""
|
||||
ObjRemisionNC.CveUsuario = UsuarioActual.CveUsuario
|
||||
ObjRemisionNC.CveEmpresa = UsuarioActual.CveEmpresa
|
||||
ObjRemisionNC.TipoCambio = 1
|
||||
ObjRemisionNC.ConvertirPesos = False
|
||||
ObjRemisionNC.CveMoneda = CveMoneda
|
||||
ObjRemisionNC.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", String.Format("CveMoneda = {0} ", CveMoneda))
|
||||
ObjRemisionNC.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", String.Format("CveMoneda = {0} ", CveMoneda))
|
||||
ObjRemisionNC.TipoDocto = "RNC"
|
||||
ObjRemisionNC.RefDocto = ""
|
||||
ObjRemisionNC.CveMesa = -1
|
||||
ObjRemisionNC.Fecha = Now
|
||||
ObjRemisionNC.CvePrePoliza = -1
|
||||
ObjRemisionNC.FechaPago = Now
|
||||
ObjRemisionNC.MotivoDescuento = ""
|
||||
ObjRemisionNC.FechaEjecucion = Now
|
||||
ObjRemisionNC.UsuarioCreo = UsuarioActual.Usuario
|
||||
ObjRemisionNC.CveCondicionEntrega = -1
|
||||
ObjRemisionNC.CondicionEntrega = ""
|
||||
ObjRemisionNC.NumeroCuenta = ""
|
||||
ObjRemisionNC.CondicionesPago = 0
|
||||
ObjRemisionNC.FormaPago = 0
|
||||
ObjRemisionNC.PedidoContrato = ""
|
||||
ObjRemisionNC.NumeroContrato = ""
|
||||
ObjRemisionNC.DescripcionContrato = ""
|
||||
ObjRemisionNC.CveCorte = -1
|
||||
ObjRemisionNC.TipoDocumento = "Remisión"
|
||||
ObjRemisionNC.Alfa1 = ""
|
||||
ObjRemisionNC.Alfa2 = ""
|
||||
ObjRemisionNC.Alfa3 = ""
|
||||
ObjRemisionNC.CveContrato = -1
|
||||
ObjRemisionNC.ConvertirPesos = False
|
||||
ObjRemisionNC.CveSubProyecto = CveSubProyecto
|
||||
ObjRemisionNC.CveSubProyectoCobranza = CveSubProyecto
|
||||
ObjRemisionNC.CveSubProyectoEjecucion = CveSubProyecto
|
||||
ObjRemisionNC.SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1).FiltroPrimero(String.Format("CveSubProyecto = {0}", CveSubProyecto)))
|
||||
ObjRemisionNC.SubProyectoMatriz = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1"))
|
||||
Me.ObjRemisionNC.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML
|
||||
Me.ObjRemisionNC.Serie = Serie
|
||||
Me.ObjRemisionNC.Folio = Folio.ToEntero()
|
||||
Me.ObjRemisionNC.Version = "3.3"
|
||||
Me.ObjRemisionNC.FolioFiscal = ""
|
||||
Me.ObjRemisionNC.CveUsuario = UsuarioActual.CveUsuario
|
||||
Me.ObjRemisionNC.CveEmpresa = UsuarioActual.CveEmpresa
|
||||
Me.ObjRemisionNC.TipoCambio = 1
|
||||
Me.ObjRemisionNC.ConvertirPesos = False
|
||||
Me.ObjRemisionNC.CveMoneda = CveMoneda
|
||||
Me.ObjRemisionNC.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", String.Format("CveMoneda = {0} ", CveMoneda))
|
||||
Me.ObjRemisionNC.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", String.Format("CveMoneda = {0} ", CveMoneda))
|
||||
Me.ObjRemisionNC.TipoDocto = "RNC"
|
||||
Me.ObjRemisionNC.RefDocto = ""
|
||||
Me.ObjRemisionNC.CveMesa = -1
|
||||
Me.ObjRemisionNC.Fecha = Now
|
||||
Me.ObjRemisionNC.CvePrePoliza = -1
|
||||
Me.ObjRemisionNC.FechaPago = Now
|
||||
Me.ObjRemisionNC.MotivoDescuento = ""
|
||||
Me.ObjRemisionNC.FechaEjecucion = Now
|
||||
Me.ObjRemisionNC.UsuarioCreo = UsuarioActual.Usuario
|
||||
Me.ObjRemisionNC.CveCondicionEntrega = -1
|
||||
Me.ObjRemisionNC.CondicionEntrega = ""
|
||||
Me.ObjRemisionNC.NumeroCuenta = ""
|
||||
Me.ObjRemisionNC.CondicionesPago = 0
|
||||
Me.ObjRemisionNC.FormaPago = 0
|
||||
Me.ObjRemisionNC.PedidoContrato = ""
|
||||
Me.ObjRemisionNC.NumeroContrato = ""
|
||||
Me.ObjRemisionNC.DescripcionContrato = ""
|
||||
Me.ObjRemisionNC.CveCorte = -1
|
||||
Me.ObjRemisionNC.TipoDocumento = "Remisión"
|
||||
Me.ObjRemisionNC.Alfa1 = ""
|
||||
Me.ObjRemisionNC.Alfa2 = ""
|
||||
Me.ObjRemisionNC.Alfa3 = ""
|
||||
Me.ObjRemisionNC.CveContrato = -1
|
||||
Me.ObjRemisionNC.ConvertirPesos = False
|
||||
Me.ObjRemisionNC.CveSubProyecto = CveSubProyecto
|
||||
Me.ObjRemisionNC.CveSubProyectoCobranza = CveSubProyecto
|
||||
Me.ObjRemisionNC.CveSubProyectoEjecucion = CveSubProyecto
|
||||
Me.ObjRemisionNC.SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1).FiltroPrimero(String.Format("CveSubProyecto = {0}", CveSubProyecto)))
|
||||
Me.ObjRemisionNC.SubProyectoMatriz = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1"))
|
||||
|
||||
'CLIENTE
|
||||
ObjRemisionNC.CveCliente = CveCliente
|
||||
ObjRemisionNC.SetCliente()
|
||||
ObjRemisionNC.CveAlmacen = -1
|
||||
Me.ObjRemisionNC.CveCliente = CveCliente
|
||||
Me.ObjRemisionNC.SetCliente()
|
||||
Me.ObjRemisionNC.CveAlmacen = -1
|
||||
|
||||
Dim ObjCliente As New ClsClientes
|
||||
If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1, TipoCliente:=-1) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
ObjRemisionNC.CveFormaPago33 = ObjCliente.CveFormaPago33
|
||||
ObjRemisionNC.FormaPago33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("FormaPago", String.Format("CveFormaPago = {0}", ObjCliente.CveFormaPago33))
|
||||
ObjRemisionNC.FormaPagoSAT33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", String.Format("CveFormaPago = {0}", ObjCliente.CveFormaPago33))
|
||||
Me.ObjRemisionNC.CveFormaPago33 = ObjCliente.CveFormaPago33
|
||||
Me.ObjRemisionNC.FormaPago33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("FormaPago", String.Format("CveFormaPago = {0}", ObjCliente.CveFormaPago33))
|
||||
Me.ObjRemisionNC.FormaPagoSAT33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", String.Format("CveFormaPago = {0}", ObjCliente.CveFormaPago33))
|
||||
|
||||
ObjRemisionNC.CveMetodoPago33 = ObjCliente.CveMetodoPago33
|
||||
ObjRemisionNC.MetodoPago33 = GlobalDTVtaMetodoPago.FiltroPrimeroValor("MetodoPago", String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33))
|
||||
ObjRemisionNC.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33))
|
||||
Me.ObjRemisionNC.CveMetodoPago33 = ObjCliente.CveMetodoPago33
|
||||
Me.ObjRemisionNC.MetodoPago33 = GlobalDTVtaMetodoPago.FiltroPrimeroValor("MetodoPago", String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33))
|
||||
Me.ObjRemisionNC.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33))
|
||||
|
||||
ObjRemisionNC.CveUsoCFDI = ObjCliente.CveUsoCFDI
|
||||
ObjRemisionNC.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("Descripcion", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI))
|
||||
ObjRemisionNC.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI))
|
||||
Me.ObjRemisionNC.CveUsoCFDI = ObjCliente.CveUsoCFDI
|
||||
Me.ObjRemisionNC.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("Descripcion", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI))
|
||||
Me.ObjRemisionNC.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI))
|
||||
|
||||
ObjRemisionNC.CveMetodoPago = ObjCliente.CveMetodoPago
|
||||
Me.ObjRemisionNC.CveMetodoPago = ObjCliente.CveMetodoPago
|
||||
|
||||
If GlobalDTMetodosPago.FiltraParametros(String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago)).Rows.Count > 0 Then
|
||||
ObjRemisionNC.MetodoPago = GlobalDTMetodosPago.FiltraParametros(String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago)).Rows(0)("MetodoPago").ToString
|
||||
Me.ObjRemisionNC.MetodoPago = GlobalDTMetodosPago.FiltraParametros(String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago)).Rows(0)("MetodoPago").ToString
|
||||
Else
|
||||
ObjRemisionNC.CveMetodoPago = 1
|
||||
ObjRemisionNC.MetodoPago = "Efectivo"
|
||||
Me.ObjRemisionNC.CveMetodoPago = 1
|
||||
Me.ObjRemisionNC.MetodoPago = "Efectivo"
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If ObjCliente.GetSucursales(CveCliente) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
ObjRemisionNC.CveClienteSucursal = If(String.IsNullOrEmpty(ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'")), -1, ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'").ToEntero())
|
||||
Me.ObjRemisionNC.CveClienteSucursal = If(String.IsNullOrEmpty(ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'")), -1, ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'").ToEntero())
|
||||
Else
|
||||
ObjRemisionNC.CveClienteSucursal = -1
|
||||
Me.ObjRemisionNC.CveClienteSucursal = -1
|
||||
End If
|
||||
End If
|
||||
ObjCliente.Dispose()
|
||||
|
||||
'DETALLES
|
||||
ObjRemisionNC.DtDetalle = CreaDTDetalleRNC()
|
||||
Me.ObjRemisionNC.DtDetalle = CreaDTDetalleRNC()
|
||||
|
||||
'VALIDA PROMOCIONES Y EXISTENCIAS
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetPromocionesPS(-1, Now, CveSubProyecto, ObjRemisionNC.CveCliente, ObjRemisionNC.CveVendedor, UsuarioActual.CveEmpresa) Then
|
||||
ObjRemisionNC.DtPromociones = ObjVentas.DtResultados.Copy()
|
||||
If ObjVentas.GetPromocionesPS(-1, Now, CveSubProyecto, Me.ObjRemisionNC.CveCliente, Me.ObjRemisionNC.CveVendedor, UsuarioActual.CveEmpresa) Then
|
||||
Me.ObjRemisionNC.DtPromociones = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
ObjRemisionNC.Observaciones = ""
|
||||
ObjRemisionNC.OrdenCompra = ""
|
||||
ObjRemisionNC.PedidoContrato = ""
|
||||
ObjRemisionNC.ObservacionesAlmacen = ""
|
||||
Me.ObjRemisionNC.Observaciones = ""
|
||||
Me.ObjRemisionNC.OrdenCompra = ""
|
||||
Me.ObjRemisionNC.PedidoContrato = ""
|
||||
Me.ObjRemisionNC.ObservacionesAlmacen = ""
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,22 +0,0 @@
|
||||
|
||||
.. PAC: 4 - Verificado : (5) 5 Certificado : (501) 506 Armado: (25) 531 Genera: (494) 1025 Timbrado: (748) 1773 ..20/08/2019:03:33 p. m.
|
||||
|
||||
.. PAC: 4 - Verificado : (2) 2 Certificado : (388) 390 Armado: (4) 394 Genera: (440) 834 Timbrado: (1030) 1864 Guardado: (361) 2225 Actualizado: (99) 2324 ..20/08/2019:03:39 p. m.
|
||||
|
||||
.. PAC: 2 - Verificado : (200) 200 Armado: (398) 598 Guardado: (564) 1162 Timbrado: (2342) 3504 Actualizado: (456) 3960 ..02/09/2019:11:00 a. m.
|
||||
|
||||
.. PAC: 2 - Verificado : (170) 170 Armado: (285) 455 Guardado: (333) 788 Timbrado: (1949) 2737 Actualizado: (20) 2757 ..02/09/2019:11:00 a. m.
|
||||
|
||||
.. PAC: 3 - Verificado : (37) 37 Armado: (43) 80 Genera: (0) 80 Timbrado: (7893) 7973 Actualizado: (19) 7992 ..05/09/2019:11:02 a. m.
|
||||
|
||||
.. PAC: 3 - Verificado : (36) 36 Armado: (32) 68 Genera: (0) 68 Timbrado: (10604) 10672 Actualizado: (16) 10688 ..05/09/2019:12:31 p. m.
|
||||
|
||||
.. PAC: 4 - Verificado : (12) 12 Certificado : (209) 221 Armado: (35) 256 Genera: (306) 562 Timbrado: (918) 1480 ..20/09/2019:05:37 p. m.
|
||||
|
||||
.. PAC: 4 - Verificado : (6) 6 Certificado : (384) 390 Armado: (27) 417 Genera: (390) 807 Timbrado: (2271) 3078 Guardado: (219) 3297 Actualizado: (902) 4199 ..01/10/2019:12:27 a. m.
|
||||
|
||||
.. PAC: 4 - Verificado : (0) 0 Certificado : (204) 204 Armado: (1) 205 Genera: (249) 454 Timbrado: (431) 885 ..01/10/2019:12:27 a. m.
|
||||
|
||||
.. PAC: 2 - Verificado : (32764) 32764 Armado: (660) 33424 Guardado: (445) 33869 Timbrado: (156762) 190631 ..06/11/2019:09:39 a. m.
|
||||
|
||||
.. PAC: 2 - Verificado : (2018) 2018 Armado: (96902) 98920 Guardado: (312) 99232 Timbrado: (1201) 100433 ..06/11/2019:09:41 a. m.
|
||||
@@ -1716,7 +1716,7 @@ Partial Class PV
|
||||
End If
|
||||
End If
|
||||
ObjCliente.Dispose()
|
||||
|
||||
UPCondicionesPago.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub CambiaSucursal()
|
||||
|
||||
@@ -1003,7 +1003,9 @@
|
||||
</table>
|
||||
<%--</asp:Panel>--%>
|
||||
|
||||
<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,CveVentaDetalle" 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="Consec,CvePS,Total, IEPS, CveClasificacion,CveUM,CveProyecto,CveSubProyecto,TipoDocto,PS,Obs,Cantidad,PU,Descuento,IVA,CantidadInventario,CantidadFacturadaRem,CveVentaDetalle"
|
||||
CssClass="table table-striped table-advance table-hover Widthall Sortable mysmallbtn ScrollAD" Style="min-width: 980px;">
|
||||
<Columns>
|
||||
<%--0--%>
|
||||
<asp:TemplateField ItemStyle-Font-Size="6pt">
|
||||
|
||||
@@ -101,6 +101,14 @@ Partial Class Ventas
|
||||
ViewState("TmpDT") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TmpDTDescNC As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDTDescNC")), Nothing, CType(ViewState("TmpDTDescNC"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("TmpDTDescNC") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property TmpDTError As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDTError")), Nothing, CType(ViewState("TmpDTError"), DataTable))
|
||||
@@ -2528,10 +2536,6 @@ Partial Class Ventas
|
||||
End If
|
||||
TxtFecha.Enabled = True
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
|
||||
TbDescuentosRNC.Visible = True
|
||||
End If
|
||||
|
||||
CargaPorcentajeMarcas()
|
||||
End Sub
|
||||
|
||||
@@ -4224,10 +4228,12 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'Si es Empresa de Acumuladores
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
'Si ya se surtió y recibió
|
||||
If DbRowVenta("SaldoAlmacen").ToString.ToDecimal > 0 And (DtUsados Is Nothing Or DtUsados.Rows.Count = 0) Then
|
||||
If (DbRowVenta("SaldoAlmacen").ToString.ToDecimal > 0 And (DtUsados Is Nothing Or DtUsados.Rows.Count = 0)) OrElse (TmpDT.MAX("CveTipoPS") = "1") Then
|
||||
BtnsFacturar.Visible = True
|
||||
Else
|
||||
BtnsFacturar.Visible = False
|
||||
@@ -5682,12 +5688,12 @@ Partial Class Ventas
|
||||
'Dim TipoDescuento As Integer
|
||||
Dim Cantidad, PU, Descuento, CantidadInventario As Decimal
|
||||
Dim CuentaPredial As String
|
||||
|
||||
Cantidad = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDecimal
|
||||
PU = Math.Round(GvPS.Rows(e.RowIndex).FCTextBox("TxtPrecio").Text.ToDecimal, 6)
|
||||
Descuento = Math.Round(GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal, NumeroDecimales)
|
||||
CuentaPredial = GvPS.Rows(e.RowIndex).FCTextBox("TxtPredial").Text.Trim
|
||||
|
||||
Dim CantidadOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Cantidad").ToDecimal()
|
||||
|
||||
Dim DatarowPS As DataRow = Nothing
|
||||
DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString.ToEntero).FiltroPrimero("") ' Estado = -1
|
||||
@@ -5708,8 +5714,9 @@ Partial Class Ventas
|
||||
Dim CvePS As Integer = DatarowPS("CvePS").ToString.ToEntero
|
||||
|
||||
CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToString.ToDecimal
|
||||
|
||||
Dim ValidaExistencia As Boolean = True
|
||||
If CantidadInventario > 0 Then 'si ya hay algo surtido, que no valide existencia
|
||||
If (CantidadInventario > 0) OrElse (Cantidad <= CantidadOriginal) Then 'si ya hay algo surtido, que no valide existencia
|
||||
ValidaExistencia = False
|
||||
End If
|
||||
|
||||
@@ -5747,7 +5754,7 @@ Partial Class Ventas
|
||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) Then
|
||||
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS}") < TxtCantidad.Text.ToDouble Then
|
||||
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
||||
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
@@ -7234,18 +7241,7 @@ Partial Class Ventas
|
||||
|
||||
'DETALLES
|
||||
If NCDescuento Then
|
||||
ObjFacturaDevolucion.DtDetalle = CreaDTDetalleNCDescuento()
|
||||
|
||||
ObjFacturaDevolucion.SubTotal = ObjFacturaDevolucion.DtDetalle.SUM("Total").ToDecimal()
|
||||
ObjFacturaDevolucion.Descuento = ObjFacturaDevolucion.DtDetalle.SUM("Descuento").ToDecimal()
|
||||
ObjFacturaDevolucion.Amortizacion = 0
|
||||
ObjFacturaDevolucion.IVA = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIVA").ToDecimal()
|
||||
ObjFacturaDevolucion.RetIVA = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetIVA").ToDecimal()
|
||||
ObjFacturaDevolucion.RetISR = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetISR").ToDecimal()
|
||||
ObjFacturaDevolucion.IEPS = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIEPS").ToDecimal()
|
||||
|
||||
Dim Total As Decimal = (ObjFacturaDevolucion.SubTotal + ObjFacturaDevolucion.IVA + ObjFacturaDevolucion.IEPS) - (ObjFacturaDevolucion.Descuento + ObjFacturaDevolucion.RetIVA + ObjFacturaDevolucion.RetISR + ObjFacturaDevolucion.Amortizacion)
|
||||
ObjFacturaDevolucion.Total = Total
|
||||
PreparaNCDescuento(ObjFacturaDevolucion)
|
||||
Else
|
||||
ObjFacturaDevolucion.DtDetalle = TmpDT
|
||||
|
||||
@@ -7403,8 +7399,9 @@ Partial Class Ventas
|
||||
DtVentasNC.Rows(0)("TCCambioValuacion") = factura.TipoCambio
|
||||
End If
|
||||
|
||||
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
|
||||
factura.Timbre = PreParaTimbre(ObjFacturaDevolucion)
|
||||
|
||||
factura.CveVentaPadre = Me.CveVenta
|
||||
'Registramos la venta
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True, NCDescuento:=True)
|
||||
|
||||
@@ -13726,6 +13723,10 @@ Partial Class Ventas
|
||||
|
||||
If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero, TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero) Then
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(572) = "1" AndAlso Not TbDescuentosRNC.Visible Then
|
||||
TbDescuentosRNC.Visible = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then
|
||||
CvePSAmortizacion = DdlPS.SelectedValue.ToEntero.ToEntero
|
||||
End If
|
||||
@@ -13760,8 +13761,57 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
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,
|
||||
Dim Cantidad As Decimal = TxtCantidad.Text.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
|
||||
|
||||
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
||||
If 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 = (Cantidad * (PU)) - Descuento
|
||||
Dim TotalFinal = TotalInicial
|
||||
'SI APLICA EL PRIMER DESCUENTO
|
||||
If PorcentajeProducto > 0 Then
|
||||
Dim Descuento1 = TotalInicial * PorcentajeProducto
|
||||
Dim Total2 = (TotalInicial - Descuento1)
|
||||
|
||||
'SI APLICA EL SEGUNDO DESCUENTO
|
||||
If PorcentajeProducto2 > 0 Then
|
||||
Dim Descuento2 = Total2 * PorcentajeProducto2
|
||||
Dim Total3 = (Total2 - Descuento2)
|
||||
|
||||
'SI APLICA EL TERCER DESCUENTO
|
||||
If PorcentajeProducto3 > 0 Then
|
||||
Dim Descuento3 = Total3 * PorcentajeProducto3
|
||||
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, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
|
||||
CvePS, "", TxtObsPS.Text.Trim, PU, Descuento,
|
||||
DdlProyecto.SelectedValue.ToEntero, DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedItem.Text,
|
||||
SerieLote:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS)
|
||||
|
||||
@@ -13987,49 +14037,49 @@ Partial Class Ventas
|
||||
DrPS("IEPSPorcentaje") = 0
|
||||
End If
|
||||
|
||||
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
||||
If 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
|
||||
''VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
||||
'If 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 = (Cantidad * (PU)) - Descuento
|
||||
Dim TotalFinal = TotalInicial
|
||||
'SI APLICA EL PRIMER DESCUENTO
|
||||
If PorcentajeProducto > 0 Then
|
||||
Dim Descuento1 = TotalInicial * PorcentajeProducto
|
||||
Dim Total2 = (TotalInicial - Descuento1)
|
||||
' Dim TotalInicial = (Cantidad * (PU)) - Descuento
|
||||
' Dim TotalFinal = TotalInicial
|
||||
' 'SI APLICA EL PRIMER DESCUENTO
|
||||
' If PorcentajeProducto > 0 Then
|
||||
' Dim Descuento1 = TotalInicial * PorcentajeProducto
|
||||
' Dim Total2 = (TotalInicial - Descuento1)
|
||||
|
||||
'SI APLICA EL SEGUNDO DESCUENTO
|
||||
If PorcentajeProducto2 > 0 Then
|
||||
Dim Descuento2 = Total2 * PorcentajeProducto2
|
||||
Dim Total3 = (Total2 - Descuento2)
|
||||
' 'SI APLICA EL SEGUNDO DESCUENTO
|
||||
' If PorcentajeProducto2 > 0 Then
|
||||
' Dim Descuento2 = Total2 * PorcentajeProducto2
|
||||
' Dim Total3 = (Total2 - Descuento2)
|
||||
|
||||
'SI APLICA EL TERCER DESCUENTO
|
||||
If PorcentajeProducto3 > 0 Then
|
||||
Dim Descuento3 = Total3 * PorcentajeProducto3
|
||||
TotalFinal = Total3 - Descuento3
|
||||
Else
|
||||
TotalFinal = Total3
|
||||
End If
|
||||
Else
|
||||
TotalFinal = Total2
|
||||
End If
|
||||
Else
|
||||
TotalFinal = TotalInicial
|
||||
End If
|
||||
' 'SI APLICA EL TERCER DESCUENTO
|
||||
' If PorcentajeProducto3 > 0 Then
|
||||
' Dim Descuento3 = Total3 * PorcentajeProducto3
|
||||
' TotalFinal = Total3 - Descuento3
|
||||
' Else
|
||||
' TotalFinal = Total3
|
||||
' End If
|
||||
' Else
|
||||
' TotalFinal = Total2
|
||||
' End If
|
||||
' Else
|
||||
' TotalFinal = TotalInicial
|
||||
' End If
|
||||
|
||||
Descuento += ((Cantidad * PU) - TotalFinal)
|
||||
' Descuento += ((Cantidad * PU) - TotalFinal)
|
||||
|
||||
End If
|
||||
End If
|
||||
' End If
|
||||
' End If
|
||||
|
||||
End If
|
||||
'End If
|
||||
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
|
||||
|
||||
Row("PU") = PU
|
||||
@@ -15182,9 +15232,7 @@ Partial Class Ventas
|
||||
|
||||
If DtMovimientos.Rows.Count > 0 Then
|
||||
Dim GeneroMovimientoAlmacen As Boolean = False
|
||||
|
||||
For Each dr As DataRow In DtMovimientos.Rows
|
||||
|
||||
'Obtenemos los Movimientos de salida
|
||||
If ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, ConceptoMovimiento, -1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
@@ -15210,32 +15258,69 @@ Partial Class Ventas
|
||||
If ErrorList.Count = 0 AndAlso MovDetalle.Rows.Count > 0 Then
|
||||
Dim CveMovimientoSalidaPorTraspaso As Integer = -1
|
||||
|
||||
'SALIDA DEFINITIVA DEL SISTEMA
|
||||
If UsuarioActual.Empresa.Funcionalidad(575) = "1" Then
|
||||
'Le damos salida normal
|
||||
If ConSalida Then
|
||||
|
||||
'Le damos salida de apartado por traspaso
|
||||
CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=AplicaMovimientoDetalleEntrada)
|
||||
GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 40, CveMoneda, CveRemision, MovimientoPrePoliza:=True, ObjConta:=ObjConta) > 0
|
||||
|
||||
If Not CveMovimientoSalidaPorTraspaso > 0 Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'Le damos entrada al general por traspaso
|
||||
If Not OcurrioError Then
|
||||
GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenEntrada, 9, CveMoneda, CveRemision, CveMovimientoRelacionado:=CveMovimientoSalidaPorTraspaso) > 0
|
||||
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
GeneroMovimientoAlmacen = GenerarMovimientoAlmacenVirtual(ObjInventario, ObjFactura) > 0
|
||||
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
'Le damos salida de apartado por traspaso
|
||||
CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=AplicaMovimientoDetalleEntrada)
|
||||
|
||||
If Not CveMovimientoSalidaPorTraspaso > 0 Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
'Le damos salida normal
|
||||
If ConSalida AndAlso Not OcurrioError Then
|
||||
GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenEntrada, 3, CveMoneda, ObjFactura.CveVenta, MovimientoPrePoliza:=True, ObjConta:=ObjConta) > 0
|
||||
'Le damos entrada al general por traspaso
|
||||
If Not OcurrioError Then
|
||||
GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenEntrada, 9, CveMoneda, CveRemision, CveMovimientoRelacionado:=CveMovimientoSalidaPorTraspaso) > 0
|
||||
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
'Le damos salida normal
|
||||
If ConSalida AndAlso Not OcurrioError Then
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
|
||||
GeneroMovimientoAlmacen = GenerarMovimientoAlmacenVirtual(ObjInventario, ObjFactura) > 0
|
||||
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not OcurrioError Then
|
||||
GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenEntrada, 3, CveMoneda, ObjFactura.CveVenta, MovimientoPrePoliza:=True, ObjConta:=ObjConta) > 0
|
||||
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -15250,6 +15335,24 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
ElseIf ObjInventario.GetMovimientos(dr("CveMovimiento").ToString.ToEntero, 3, -1, UsuarioActual.CveEmpresa) Then
|
||||
'If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
' Dim CveTipoAlmacen As Integer = ObjInventario.DtResultados.Rows(0)("CveTipoAlmacen").ToString().ToEntero()
|
||||
' If CveTipoAlmacen = 24 Then
|
||||
' Dim RowMov As DataRow = ObjInventario.DtResultados.Rows(0)
|
||||
|
||||
' Dim CveMovimientoSalida As Integer = RowMov("CveMovimiento").ToString().ToEntero()
|
||||
' Dim CveAlmacen As Integer = RowMov("CveAlmacen").ToString().ToEntero()
|
||||
' Dim CveMoneda As Integer = RowMov("CveMoneda").ToString().ToEntero()
|
||||
|
||||
' GeneroMovimientoAlmacen = GenerarMovimientoAlmacenVirtual(ObjInventario, CveMovimientoSalida, CveAlmacen, CveMoneda) > 0
|
||||
|
||||
' If Not GeneroMovimientoAlmacen Then
|
||||
' OcurrioError = True
|
||||
' Exit For
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
|
||||
'Esquema viejo, evitamos que aparezca por surtir
|
||||
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
|
||||
OcurrioError = True
|
||||
@@ -15478,6 +15581,121 @@ Partial Class Ventas
|
||||
End If
|
||||
'Return Not OcurrioError
|
||||
|
||||
End Function
|
||||
Private Function GenerarMovimientoAlmacenVirtual(ByRef ObjInventario As ClsInventarios, ObjFactura As Modelos.Factura) As Integer
|
||||
Dim OcurrioError As Boolean = False
|
||||
Dim CveMovimientoVirtual As Integer = -1
|
||||
|
||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||
DtPSVirtual.Columns.Add(New DataColumn("CvePS", GetType(Integer)))
|
||||
DtPSVirtual.Columns.Add(New DataColumn("Cantidad", GetType(Decimal)))
|
||||
DtPSVirtual.Columns.Add(New DataColumn("PU", GetType(Decimal)))
|
||||
DtPSVirtual.Columns.Add(New DataColumn("CveUM", GetType(Integer)))
|
||||
|
||||
Dim DtTamanios As DataTable = Nothing
|
||||
Dim ObjAcumuladores As New ClsAcumuladores
|
||||
If ObjAcumuladores.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
|
||||
DtTamanios = ObjAcumuladores.DtResultados.Copy()
|
||||
End If
|
||||
ObjAcumuladores.Dispose()
|
||||
|
||||
Dim CveConceptoMovimientoVirtual As Integer = 3
|
||||
Dim CveAlmacenVirtual As Integer = -1
|
||||
|
||||
For Each GvRow As DataRow In ObjFactura.DtDetalle.Rows
|
||||
For Each Tam As DataRow In DtTamanios.Rows
|
||||
If Tam("CveTamaño").ToString() = GvRow("CveTamaño").ToString() Then
|
||||
Dim CvePSCargo = Tam("CvePSCargo").ToString().ToEntero()
|
||||
Dim Row As DataRow = DtPSVirtual.NewRow()
|
||||
|
||||
Row("CvePS") = CvePSCargo
|
||||
Row("Cantidad") = GvRow("Cantidad").ToString().ToDecimal()
|
||||
Row("PU") = 0
|
||||
Row("CveUM") = GvRow("CveUM").ToString().ToEntero()
|
||||
|
||||
DtPSVirtual.Rows.Add(Row)
|
||||
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={ObjFactura.CveSubProyecto}").ToEntero()
|
||||
|
||||
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 Then
|
||||
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, ObjFactura.CveVenta, -1, -1)
|
||||
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
For Each RowUsado As DataRow In DtPSVirtual.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Double = RowUsado("PU").ToString().ToDouble()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
If DtPSVirtual.Rows.Count = 0 Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'Dim ContadorMovtosDetalles = 0
|
||||
|
||||
'Dim DtMovDetalle As DataTable = Nothing
|
||||
'If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
' DtMovDetalle = ObjInventario.DtResultados.Copy()
|
||||
'End If
|
||||
|
||||
''Creamos el movimiento
|
||||
'Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, 2, CveMoneda, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, CveMovimientoRelacionado:=CveMovimientoSalida)
|
||||
|
||||
'If CveMovimientoInventario > 0 Then
|
||||
|
||||
' 'Agregamos los detalles
|
||||
' For Each MovDet As DataRow In DtMovDetalle.Rows
|
||||
' Dim Cantidad = MovDet("Cantidad").ToString.ToDecimal
|
||||
' Dim CveUnidad As Integer = MovDet("CveUM").ToString.ToEntero
|
||||
' Dim PU As Decimal = MovDet("PU").ToString.ToDecimal
|
||||
' Dim CveProducto As Integer = MovDet("CvePS").ToString.ToEntero
|
||||
' Dim SerieLote As String = MovDet("SerieLote").ToString
|
||||
|
||||
' If Cantidad < 0 Then
|
||||
' Alert("Ocurrió un Error al generar los movimientos de almacén. Por favor comuniquese con atención SIG.", TipoMensaje.MsgError)
|
||||
' OcurrioError = True
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
' If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote) Then
|
||||
' ContadorMovtosDetalles += 1
|
||||
' Else
|
||||
' OcurrioError = True
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' 'VALIDA QUE SE HALLAN AGREGADO DETALLES AL MOVIMIENTO
|
||||
' If ContadorMovtosDetalles = 0 Then
|
||||
' OcurrioError = True
|
||||
' End If
|
||||
|
||||
'Else
|
||||
' OcurrioError = True
|
||||
'End If
|
||||
|
||||
If OcurrioError Then
|
||||
Return -1
|
||||
Else
|
||||
Return CveMovimientoVirtual
|
||||
End If
|
||||
|
||||
End Function
|
||||
Private Function SalidaAlmacenMateriales(ByRef ObjInventario As ClsInventarios, CveOS As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean
|
||||
Dim TieneError As Boolean = False
|
||||
@@ -16841,18 +17059,25 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Private Function ValidaPagosContado() As Boolean
|
||||
Dim Retorno = False
|
||||
'SI TIENE SALDO PENDIENTE VALIDA SI TIENE PAGOS
|
||||
If Me.SaldoVenta > 0 Then
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso (UsuarioActual.Empresa.Funcionalidad(531) = "1") AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then
|
||||
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso (UsuarioActual.CveEmpresa = 140) AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then
|
||||
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
|
||||
Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, ListaNCDesc.Sum(Function(f) f.TotalRemNCAplicado), 0)
|
||||
If TotalNC > 0 Then
|
||||
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TotalNC Then
|
||||
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
|
||||
Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, LblTotalNC.Text.Trim().ToDecimal(), 0)
|
||||
If TotalNC > 0 Then
|
||||
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TotalNC Then
|
||||
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
End If
|
||||
Else
|
||||
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
|
||||
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
|
||||
@@ -16860,11 +17085,6 @@ Partial Class Ventas
|
||||
Retorno = True
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
|
||||
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
End If
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
@@ -20626,7 +20846,7 @@ Partial Class Ventas
|
||||
Private Sub CargaCxC()
|
||||
Dim ObjMovtos As New ClsMovimientos()
|
||||
If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero) Then
|
||||
Dim DtTemporal As DataTable = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento")
|
||||
Dim DtTemporal As DataTable = ObjMovtos.DtResultados.FiltraParametros("TipoDocto <> 'RNC' AND Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento")
|
||||
GvCxC.DataSource = DtTemporal
|
||||
End If
|
||||
ObjMovtos.Dispose()
|
||||
@@ -20726,10 +20946,8 @@ Partial Class Ventas
|
||||
|
||||
If AplicaNCMasiva Then
|
||||
If NCDescuento Then
|
||||
For Each Gvr As GridViewRow In GvDescNC.Rows
|
||||
If Gvr.FCCheckBox("ChkAplicar").Checked Then
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal), True, MissingSchemaAction.Ignore)
|
||||
End If
|
||||
For Each RNC In ListaNCDesc
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True), True, MissingSchemaAction.Ignore)
|
||||
Next
|
||||
Else
|
||||
For Each Gvr As GridViewRow In GvCxC.Rows
|
||||
@@ -20780,14 +20998,32 @@ Partial Class Ventas
|
||||
|
||||
AplicaNC = True
|
||||
|
||||
If Not NCDescuento Then
|
||||
If NCDescuento Then
|
||||
TmpDTDescNC = TmpDT.Clone()
|
||||
TmpDTDescNC.Clear()
|
||||
|
||||
For Each Dr As DataRow In DtImpuestos.Rows
|
||||
AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero,
|
||||
DrPS("CveUM").ToString.ToEntero, DrPS("UnidadMedida").ToString, DrPS("CveClasificacion").ToString.ToEntero, DrPS("Clasificacion").ToString, CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
|
||||
TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("ImporteRetIVA").ToString.ToDecimal,
|
||||
Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("ImporteRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("ImporteIEPS").ToString.ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString.ToDecimal, "", "", -1, -1,
|
||||
DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1)
|
||||
Next
|
||||
|
||||
TrTipoRelacion.Visible = True
|
||||
DdlTiposRelacion.SelectedValueExist("1")
|
||||
|
||||
'verifica el tipo de cambio que se actualice
|
||||
If DdlMoneda.SelectedValue <> "1" Then
|
||||
TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString
|
||||
End If
|
||||
Else
|
||||
If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta
|
||||
|
||||
DdlTipoComprobante.SelectedValueExist("Egs")
|
||||
|
||||
For Each Dr As DataRow In DtImpuestos.Rows
|
||||
AgregaTempDT(DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero,
|
||||
AgregaTempDT(TmpDT, DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero,
|
||||
DrPS("CveUM").ToString.ToEntero, DrPS("UnidadMedida").ToString, DrPS("CveClasificacion").ToString.ToEntero, DrPS("Clasificacion").ToString, CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
|
||||
TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("ImporteRetIVA").ToString.ToDecimal,
|
||||
Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("ImporteRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("ImporteIEPS").ToString.ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString.ToDecimal, "", "", -1, -1,
|
||||
@@ -20817,14 +21053,14 @@ Partial Class Ventas
|
||||
|
||||
LBNotaCredito.Visible = False
|
||||
CambiaTipoDocto()
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal) As DataTable
|
||||
Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False) As DataTable
|
||||
Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0
|
||||
|
||||
Dim TmpDT As DataTable = Nothing
|
||||
Dim ObjVentas As New ClsVentas
|
||||
|
||||
If ObjVentas.GetVentaDetalle(CveVentaNC) Then
|
||||
@@ -20874,12 +21110,15 @@ Partial Class Ventas
|
||||
DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal") = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString.ToDecimal + difTmp
|
||||
End If
|
||||
|
||||
If Not NCDescuento Then
|
||||
Me.TmpDT = TmpDT
|
||||
End If
|
||||
'CARGA FACTURA A LA CUAL SE APLICA LA NC
|
||||
'CargaNCDT(CveVentaNC, Importe.ToDecimal)
|
||||
Return DtImpuestosLocal
|
||||
End Function
|
||||
|
||||
Private Sub AgregaTempDT(CvePS As Integer, PS As String, Codigo As String, CodigoPS As String, CveTipoPS As Integer, CveTipoInvPS As Integer, CveUM As Integer, UM As String,
|
||||
Private Sub AgregaTempDT(ByRef TmpDT As DataTable, CvePS As Integer, PS As String, Codigo As String, CodigoPS As String, CveTipoPS As Integer, CveTipoInvPS As Integer, CveUM As Integer, UM As String,
|
||||
CveClasificacion As Integer, Clasificacion As String, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String,
|
||||
Obs As String, Cantidad As Double, PU As Double, PorcentajeIVA As Double, ImporteIVA As Double, PorcentajeRetIVA As Double, ImporteRetIVA As Double,
|
||||
PorcentajeRetISR As Double, ImporteRetISR As Double, PorcentajeIEPS As Double, ImporteIEPS As Double, TipoDescuento As Integer, Descuento As Double,
|
||||
@@ -21160,7 +21399,7 @@ Partial Class Ventas
|
||||
Dim ImporteRetISR As Decimal = TotalImpuestos * Gv.DataKey("PorcentajeRetISR").ToString.ToDecimal
|
||||
Dim ImporteIEPS As Decimal = TotalImpuestos * Gv.DataKey("PorcentajeIEPS").ToString.ToDecimal
|
||||
|
||||
AgregaTempDT(Gv.DataKey("CvePS").ToString.ToEntero, Gv.DataKey("PS").ToString, Gv.DataKey("Codigo").ToString, Gv.DataKey("CodigoPS").ToString,
|
||||
AgregaTempDT(TmpDT, Gv.DataKey("CvePS").ToString.ToEntero, Gv.DataKey("PS").ToString, Gv.DataKey("Codigo").ToString, Gv.DataKey("CodigoPS").ToString,
|
||||
Gv.DataKey("CveTipoPS").ToString.ToEntero, Gv.DataKey("CveTipoInvPS").ToString.ToEntero,
|
||||
Gv.DataKey("CveUM").ToString.ToEntero, Gv.DataKey("UM").ToString, Gv.DataKey("CveClasificacion").ToString.ToEntero,
|
||||
Gv.DataKey("Clasificacion").ToString, Gv.DataKey("CveProyecto").ToString.ToEntero, Gv.DataKey("Proyecto").ToString,
|
||||
@@ -23412,7 +23651,7 @@ Partial Class Ventas
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "D E S C U E N T O S X R E M I S I O N D E N O T A D E C R E D I T O"
|
||||
Protected Sub BtnAplicarRemisionNC_Click(sender As Object, e As EventArgs)
|
||||
If ListaRemisionesNC Is Nothing Then
|
||||
ListaRemisionesNC = New List(Of Modelos.Factura)
|
||||
@@ -23498,107 +23737,32 @@ Partial Class Ventas
|
||||
|
||||
RegistraScript("$('#ModalAplicarDescuentoNC').modal('hide'); ")
|
||||
End Sub
|
||||
Protected Sub PreparaNCDescuento(ByRef factura As Modelos.Factura)
|
||||
If TmpDTDescNC IsNot Nothing Then
|
||||
factura.DtDetalle = TmpDTDescNC
|
||||
'**** IMPUESTOS LOCALES
|
||||
|
||||
Protected Function CreaDTDetalleNCDescuento() As DataTable
|
||||
Dim Dt As DataTable = TmpDT.Clone()
|
||||
Dt.Rows.Clear()
|
||||
Dim TotalSubTotal As Decimal = TmpDTDescNC.SUM("TotalImporte").ToDecimal
|
||||
Dim TotalDescuentos As Decimal = TmpDTDescNC.SUM("Descuento").ToDecimal
|
||||
|
||||
Dim CveSATNC = "84111506"
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
|
||||
Dim TotalIVA As Decimal = TmpDTDescNC.SUM("ImporteIVA").ToDecimal
|
||||
Dim TotalIEPS As Decimal = TmpDTDescNC.SUM("ImporteIEPS").ToDecimal
|
||||
Dim TotalRetIVA As Decimal = TmpDTDescNC.SUM("ImporteRetIVA").ToDecimal
|
||||
Dim TotalRetISR As Decimal = TmpDTDescNC.SUM("ImporteRetISR").ToDecimal
|
||||
Dim Total As Decimal = 0
|
||||
Dim TotalImpuestosLocales As Decimal = 0
|
||||
Total = (TotalSubTotal - TotalDescuentos + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
|
||||
|
||||
factura.SubTotal = TotalSubTotal
|
||||
factura.Descuento = TotalDescuentos
|
||||
factura.IVA = TotalIVA
|
||||
factura.IEPS = TotalIEPS
|
||||
factura.RetIVA = TotalRetIVA
|
||||
factura.RetISR = TotalRetISR
|
||||
factura.Total = Total
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
Return Dt
|
||||
End If
|
||||
Dim CvePS = DrPS("CvePS").ToString().ToEntero()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = 0
|
||||
Dim PU = Math.Round(ListaNCDesc.Sum(Function(RNC) RNC.TotalRemNCAplicado), 6) ' el precio unitario puede llevar hasta 6 decimales permitidos
|
||||
Dim Cantidad As Decimal = 1
|
||||
Dim Descuento As Decimal = 0
|
||||
|
||||
Dim Row As DataRow = Dt.NewRow()
|
||||
Row("CveProyecto") = DdlProyecto.SelectedValue.ToEntero()
|
||||
Row("Proyecto") = DdlProyecto.SelectedItem.Text
|
||||
Row("CveSubProyecto") = DdlSubProyecto.SelectedValue.ToEntero()
|
||||
Row("SubProyecto") = DdlSubProyecto.SelectedItem.Text
|
||||
Row("SerieLote") = "-1"
|
||||
Row("TiempoEntrega") = ""
|
||||
Row("Orden") = Dt.Rows.Count + 1
|
||||
Row("Cantidad") = Cantidad
|
||||
Row("CveUM") = DrPS("CveUM").ToString().ToEntero()
|
||||
Row("UM") = ""
|
||||
Row("CveClasificacion") = DrPS("CveClasificacion").ToString().ToEntero()
|
||||
Row("Clasificacion") = ""
|
||||
Row("CvePS") = CvePS
|
||||
Row("Obs") = ""
|
||||
|
||||
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
|
||||
|
||||
Row("PU") = PU
|
||||
Row("Codigo") = DrPS("Codigo")
|
||||
Row("NoIdentificacion") = DrPS("Codigo")
|
||||
Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria")
|
||||
Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana")
|
||||
Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion")
|
||||
Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion")
|
||||
|
||||
If Modalidad = "U" Then
|
||||
Row("Consec") = Index
|
||||
Else
|
||||
Row("Consec") = TmpDT.Rows.Count + 1
|
||||
End If
|
||||
|
||||
Row("PS") = DrPS("PS")
|
||||
Row("CodigoPS") = DrPS("PSCodigo").ToString
|
||||
Row("CveTipoPS") = DrPS("CveTipoPS")
|
||||
Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
|
||||
Row("CveTamaño") = DrPS("CveTamaño")
|
||||
Row("CveClasificacion") = DrPS("CveClasificacion")
|
||||
Row("Clasificacion") = DrPS("Clasificacion")
|
||||
|
||||
If DrPS("IVA").ToString.Contiene("-1", "") Then
|
||||
Row("PorcentajeIVA") = PorcentajeIVA
|
||||
Else
|
||||
Row("PorcentajeIVA") = DrPS("IVA")
|
||||
End If
|
||||
|
||||
Row("IVA") = Row("PorcentajeIVA")
|
||||
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
||||
Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
||||
Row("PorcentajeRetIVA") = ClienteRetIVA
|
||||
Row("PorcentajeRetISR") = ClienteRetISR
|
||||
Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
|
||||
Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
Row("IEPS") = Row("ImporteIEPS")
|
||||
Row("Descuento") = Math.Round(Descuento, NumeroDecimales)
|
||||
Row("TipoDescuento") = HdnTipoDescuento.Value
|
||||
Row("Total") = (Cantidad * PU)
|
||||
Row("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales)
|
||||
|
||||
Row("SATClaveProdServ") = DrPS("SATClavePS")
|
||||
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
Row("CvePresupuestoIngreso") = Me.DdlFuenteRecaudacion.SelectedValue
|
||||
End If
|
||||
|
||||
Row("EntregaDirecta") = -1
|
||||
'Contratos
|
||||
Row("CveContratoDetalle") = -1
|
||||
Row("CveVentaDetalle") = -1
|
||||
Row("CveMovimientoDetallePedido") = -1
|
||||
Row("CveOrdenCompraDetalle") = -1
|
||||
Row("CveVentaDetalleRemision") = -1
|
||||
Row("CveVentaDetalleCotizacion") = -1
|
||||
Row("CveVentaDetallePedido2") = -1
|
||||
Row("CuentaPredial") = "-1"
|
||||
Row("Consec") = 1
|
||||
|
||||
'RECARGAR GV
|
||||
Dt.Rows.Add(Row)
|
||||
|
||||
Return Dt
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user