Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -4877,10 +4877,21 @@ Public Class ClsPaginas
|
|||||||
End Select
|
End Select
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' End If
|
If Pagina.ToUpper() = ("/Ventas/Ventas.aspx").ToUpper() Then
|
||||||
|
Select Case Request("Op")
|
||||||
|
Case "Cot" : Retorno = 366
|
||||||
|
Case "Rem" : Retorno = 2018
|
||||||
|
Case Else : Retorno = 6
|
||||||
|
End Select
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Pagina.ToUpper() = ("/Ventas/RepVentas.aspx").ToUpper() Then
|
||||||
|
Select Case Request("Op")
|
||||||
|
Case "Cot" : Retorno = 367
|
||||||
|
Case Else : Retorno = 9
|
||||||
|
End Select
|
||||||
|
End If
|
||||||
|
|
||||||
'PaginaDict = Nothing
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@@ -807,6 +807,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaCompra(pCveCompra As Integer, pCveProveedor As Integer)
|
Private Sub CargaCompra(pCveCompra As Integer, pCveProveedor As Integer)
|
||||||
|
CargaAlmacenes(-1)
|
||||||
|
|
||||||
Dim ObjCompras As New ClsCompras
|
Dim ObjCompras As New ClsCompras
|
||||||
Dim ObjInventario As New ClsInventarios
|
Dim ObjInventario As New ClsInventarios
|
||||||
|
|
||||||
@@ -838,16 +840,34 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
CargaAlmacenes(-1, "21,2")
|
CargaAlmacenes(-1, "21,2")
|
||||||
End If
|
End If
|
||||||
RecibidaCompleta = False
|
RecibidaCompleta = False
|
||||||
|
|
||||||
|
Dim CargaSoloUsados As Boolean = False
|
||||||
If ObjInventario.RecepcionAlmacenGet(pCveCompra, BuscaEntregaDirecta, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
If ObjInventario.RecepcionAlmacenGet(pCveCompra, BuscaEntregaDirecta, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||||
|
Dim DtRecepcion As DataTable = Nothing
|
||||||
|
Dim NumUsados = ObjInventario.DtResultados.COUNT("EsUsado", "EsUsado = True").ToEntero()
|
||||||
|
Dim NumProductos = ObjInventario.DtResultados.COUNT("EsUsado", "EsUsado = False").ToEntero()
|
||||||
|
|
||||||
|
'SI LA COMPRA TIENE PRODUCTOS Y USADOS SOLO MOSTRAR LOS PRODUCTOS
|
||||||
|
If NumProductos > 0 AndAlso NumUsados > 0 Then
|
||||||
|
DtRecepcion = ObjInventario.DtResultados.FiltraParametros("EsUsado = False")
|
||||||
|
'SI LA COMPRA TIENE PUROS USADOS, MOSTRAR LOS USADOS Y CARGAR LOS ALMACENES
|
||||||
|
ElseIf NumProductos = 0 AndAlso NumUsados > 0 Then
|
||||||
|
CargaSoloUsados = True
|
||||||
|
DtRecepcion = ObjInventario.DtResultados.Copy()
|
||||||
|
CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero, "22")
|
||||||
|
Else
|
||||||
|
DtRecepcion = ObjInventario.DtResultados.Copy()
|
||||||
|
End If
|
||||||
|
|
||||||
DtDatosDetalle = Nothing
|
DtDatosDetalle = Nothing
|
||||||
CreaDtDetalle()
|
CreaDtDetalle()
|
||||||
DtDatosLoteDetalle = Nothing
|
DtDatosLoteDetalle = Nothing
|
||||||
CreaDtLoteDetalle()
|
CreaDtLoteDetalle()
|
||||||
CreaDTInv(ObjInventario.DtResultados)
|
CreaDTInv(DtRecepcion)
|
||||||
BtnGuardar.Visible = True
|
BtnGuardar.Visible = True
|
||||||
|
|
||||||
'cuando están todos los detalles de la compra, nos indica que se va a recibir la totalidad de la compra
|
'cuando están todos los detalles de la compra, nos indica que se va a recibir la totalidad de la compra
|
||||||
If ObjInventario.DtResultados.Rows.Count = ObjInventario.DtResultados.Rows(0)("NumDetalles").ToString.ToEntero Then
|
If DtRecepcion.Rows.Count = DtRecepcion.Rows(0)("NumDetalles").ToString.ToEntero Then
|
||||||
RecibidaCompleta = True
|
RecibidaCompleta = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -869,8 +889,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
LtAdvertencia.Text = "La mercancía tendra salida inmediata por ser entrega directa al cliente"
|
LtAdvertencia.Text = "La mercancía tendra salida inmediata por ser entrega directa al cliente"
|
||||||
DivAdvertencia.Visible = True
|
DivAdvertencia.Visible = True
|
||||||
EntregaDirecta = True
|
EntregaDirecta = True
|
||||||
CveCliente = ObjInventario.DtResultados.Rows(0)("CveCliente").ToString.ToEntero
|
CveCliente = DtRecepcion.Rows(0)("CveCliente").ToString.ToEntero
|
||||||
CveVendedor = ObjInventario.DtResultados.Rows(0)("CveVendedor").ToString.ToEntero
|
CveVendedor = DtRecepcion.Rows(0)("CveVendedor").ToString.ToEntero
|
||||||
|
|
||||||
|
|
||||||
If DtInv.COUNT("EntregaDirecta") <> DtInv.Rows.Count Then
|
If DtInv.COUNT("EntregaDirecta") <> DtInv.Rows.Count Then
|
||||||
@@ -884,7 +904,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
Alert("No hay productos pendientes de surtir de esta compra. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
Alert("No hay productos pendientes de surtir de esta compra. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||||
Else
|
Else
|
||||||
|
|
||||||
If ObjInventario.DtResultados.Rows(0)("CveVendedor").ToString.ToEntero > 0 And ObjInventario.DtResultados.Rows(0)("CveCliente").ToString.ToEntero > 0 Then
|
If DtRecepcion.Rows(0)("CveVendedor").ToString.ToEntero > 0 And DtRecepcion.Rows(0)("CveCliente").ToString.ToEntero > 0 Then
|
||||||
If DtInv.SUM("EntregaDirecta") > 0 Then
|
If DtInv.SUM("EntregaDirecta") > 0 Then
|
||||||
''ENTREGA DIRECTA
|
''ENTREGA DIRECTA
|
||||||
'LtAdvertencia.Text = "La mercancía tendra salida inmediata por ser entrega directa al cliente"
|
'LtAdvertencia.Text = "La mercancía tendra salida inmediata por ser entrega directa al cliente"
|
||||||
@@ -892,9 +912,9 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
'EntregaDirecta = True
|
'EntregaDirecta = True
|
||||||
Else
|
Else
|
||||||
'APARTADO
|
'APARTADO
|
||||||
'If UsuarioActual.CveUsuario.Contiene(100) Or (ObjInventario.DtResultados.Rows(0)("CveUsuarioOC").ToString.ToEntero = 1559 And ObjInventario.DtResultados.Rows(0)("FechaIngOC").ToString.ToDateTime > "2017-04-24 12:00".ToDateTime) Then
|
'If UsuarioActual.CveUsuario.Contiene(100) Or (DtRecepcion .Rows(0)("CveUsuarioOC").ToString.ToEntero = 1559 And DtRecepcion .Rows(0)("FechaIngOC").ToString.ToDateTime > "2017-04-24 12:00".ToDateTime) Then
|
||||||
If UsuarioActual.Empresa.Funcionalidad(148) = "1" Then
|
If UsuarioActual.Empresa.Funcionalidad(148) = "1" Then
|
||||||
CveAlmacenApartado = ObjInventario.DtResultados.Rows(0)("CveAlmacenApartado").ToString.ToEntero
|
CveAlmacenApartado = DtRecepcion.Rows(0)("CveAlmacenApartado").ToString.ToEntero
|
||||||
DivAdvertencia.Visible = True
|
DivAdvertencia.Visible = True
|
||||||
Apartado = True
|
Apartado = True
|
||||||
|
|
||||||
@@ -903,7 +923,11 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
LtAdvertencia.Text = "No se puede recibir la mercancía por ser de apartados y no contar con un almacen de apartado."
|
LtAdvertencia.Text = "No se puede recibir la mercancía por ser de apartados y no contar con un almacen de apartado."
|
||||||
Else
|
Else
|
||||||
LtAdvertencia.Text = "La mercancía sera traspasada ha apartados"
|
LtAdvertencia.Text = "La mercancía sera traspasada ha apartados"
|
||||||
CargaAlmacenes(ObjInventario.DtResultados.Rows(0)("CveSubProyecto").ToString.ToEntero)
|
If CargaSoloUsados Then
|
||||||
|
CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero, "22")
|
||||||
|
Else
|
||||||
|
CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
'End If
|
'End If
|
||||||
@@ -912,19 +936,19 @@ Partial Class Inventarios_RecepcionAlmacen
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim CantidadFaltante As Double = ObjInventario.DtResultados.SUM("CantidadC", "CantidadF > 0")
|
Dim CantidadFaltante As Double = DtRecepcion.SUM("CantidadC", "CantidadF > 0")
|
||||||
|
|
||||||
If UsuarioActual.Empresa.UsaAC AndAlso CantidadFaltante > 0 Then
|
If UsuarioActual.Empresa.UsaAC AndAlso CantidadFaltante > 0 Then
|
||||||
PnlAC.Visible = True
|
PnlAC.Visible = True
|
||||||
CargaAC()
|
CargaAC()
|
||||||
LbTotalPorDevengar.Text = ObjInventario.DtResultados.SUM("Total", "CantidadF > 0").FormatoNumero
|
LbTotalPorDevengar.Text = DtRecepcion.SUM("Total", "CantidadF > 0").FormatoNumero
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
'Existencias
|
'Existencias
|
||||||
If TipoMovimiento = 2 Then
|
If TipoMovimiento = 2 Then
|
||||||
If ObjInventario.ComprasDevolucionExistenciasGet(CveCompraSurtir) Then
|
If ObjInventario.ComprasDevolucionExistenciasGet(CveCompraSurtir) Then
|
||||||
DtExistencias = ObjInventario.DtResultados
|
DtExistencias = DtRecepcion
|
||||||
Else
|
Else
|
||||||
Alert("No se pudieron cargar las existencias del movimiento de entrada, por lo cual no se podra hacer la devolución.", TipoMensaje.MsgError)
|
Alert("No se pudieron cargar las existencias del movimiento de entrada, por lo cual no se podra hacer la devolución.", TipoMensaje.MsgError)
|
||||||
BtnGuardar.Enabled = False
|
BtnGuardar.Enabled = False
|
||||||
|
|||||||
@@ -2918,7 +2918,7 @@
|
|||||||
<div class="form-group form-md-line-input input-iconright">
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
<asp:TextBox ID="TxtCodInspeccion" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
|
<asp:TextBox ID="TxtCodInspeccion" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
|
||||||
<asp:CustomValidator id="CVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" ClientValidationFunction="ValidarCodigoInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
|
<asp:CustomValidator id="CVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" ClientValidationFunction="ValidarCodigoInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
|
||||||
<asp:RegularExpressionValidator ID="REVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" ValidationExpression="^[A-L][0-9][1-9A-Z][A-HJ-M]$"></asp:RegularExpressionValidator>
|
<%-- <asp:RegularExpressionValidator ID="REVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" ValidationExpression="^[A-L][0-9][1-9A-Z][A-HJ-M]$"></asp:RegularExpressionValidator>--%>
|
||||||
<%--<asp:RequiredFieldValidator ID="RFVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspeccion''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
|
<%--<asp:RequiredFieldValidator ID="RFVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspeccion''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
|
||||||
<%--<ajax:ValidatorCalloutExtender ID="VCECodInspeccion" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodInspeccion"></ajax:ValidatorCalloutExtender>--%>
|
<%--<ajax:ValidatorCalloutExtender ID="VCECodInspeccion" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodInspeccion"></ajax:ValidatorCalloutExtender>--%>
|
||||||
<label for="<%= TxtCodInspeccion.ClientID.ToString()%>">Cod. Inspección:</label>
|
<label for="<%= TxtCodInspeccion.ClientID.ToString()%>">Cod. Inspección:</label>
|
||||||
@@ -3019,7 +3019,8 @@
|
|||||||
|
|
||||||
//SI ES MOTOBATERIA
|
//SI ES MOTOBATERIA
|
||||||
if (CveClasificacion = "20517") {
|
if (CveClasificacion = "20517") {
|
||||||
regex = "[*]|"
|
regex = "[1X]|"
|
||||||
|
//regex = "[*]|"
|
||||||
//SI ES OPTIMA
|
//SI ES OPTIMA
|
||||||
} else if (CveClasificacion = "20511") {
|
} else if (CveClasificacion = "20511") {
|
||||||
regex = "[1X]|"
|
regex = "[1X]|"
|
||||||
@@ -3064,15 +3065,25 @@
|
|||||||
let clasificaciones = ["20517", "20511"]
|
let clasificaciones = ["20517", "20511"]
|
||||||
|
|
||||||
//SI ES MOTOBATERIA
|
//SI ES MOTOBATERIA
|
||||||
if (clasificaciones.includes(CveClasificacion)) {
|
if (CveClasificacion = "20517") {
|
||||||
var re = new RegExp("^[*]|[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
var re = new RegExp("^[X]|[x]|[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||||
arguments.IsValid = re.test(parseInt(arguments.Value));
|
arguments.IsValid = re.test(arguments.Value);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
var re = new RegExp("^[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
var re = new RegExp("^[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||||
arguments.IsValid = re.test(arguments.Value);
|
arguments.IsValid = re.test(arguments.Value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//if (clasificaciones.includes(CveClasificacion)) {
|
||||||
|
// //var re = new RegExp("^[*]|[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||||
|
// var re = new RegExp("^[X]|[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||||
|
// arguments.IsValid = re.test(parseInt(arguments.Value));
|
||||||
|
// return;
|
||||||
|
//} else {
|
||||||
|
// var re = new RegExp("^[A-L][0-9][1-9A-Z][A-HJ-M]$");
|
||||||
|
// arguments.IsValid = re.test(arguments.Value);
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
function CalculaMesesUso() {
|
function CalculaMesesUso() {
|
||||||
|
|||||||
@@ -5098,7 +5098,7 @@ Partial Class PV
|
|||||||
|
|
||||||
Dim ObjGral As New ClsGenerales
|
Dim ObjGral As New ClsGenerales
|
||||||
If ObjGral.BCIUsadoGet(UsuarioActual.CveEmpresa) Then
|
If ObjGral.BCIUsadoGet(UsuarioActual.CveEmpresa) Then
|
||||||
e.Row.FCDropDownList("DdlBCIUsado").DataSource = ObjGral.DtResultados
|
e.Row.FCDropDownList("DdlBCIUsado").DataSource = ObjGral.DtResultados.FiltraParametros(String.Format("CveTamaño = {0}", e.Row.DataKey("CveTamaño")))
|
||||||
End If
|
End If
|
||||||
'DdlBCIUsado.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
'DdlBCIUsado.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||||
'DdlBCIUsado.SelectedValueExist(-1)
|
'DdlBCIUsado.SelectedValueExist(-1)
|
||||||
|
|||||||
@@ -6890,7 +6890,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
If ErrorList.Count = 0 Then
|
If ErrorList.Count = 0 Then
|
||||||
If ObjFactura.CveVenta > 0 And CveAlmacenExistenciasContrato > 0 And DdlTipoComprobante.SelectedValue = "Ing" Then
|
If ObjFactura.CveVenta > 0 And CveAlmacenExistenciasContrato > 0 And DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||||
If Not RegistraAlmacenConsignacionVenta(ObjInventario, ObjFactura) Then
|
If Not RegistraAlmacenConsignacionVenta(ObjInventario, ObjConta, ObjFactura, ObjContPaq) Then
|
||||||
ErrorList.Add("Ocurrió un error al registrar los movimientos de almacén del contrato de consignación")
|
ErrorList.Add("Ocurrió un error al registrar los movimientos de almacén del contrato de consignación")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -11533,8 +11533,8 @@ Partial Class Ventas
|
|||||||
HdnTieneAnticiposVinculados.Value = "0"
|
HdnTieneAnticiposVinculados.Value = "0"
|
||||||
|
|
||||||
Dim ObjMovtos As New ClsMovimientos()
|
Dim ObjMovtos As New ClsMovimientos()
|
||||||
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, DdlMoneda.SelectedValue.ToEntero) Then
|
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then
|
||||||
GVAnticipos.DataSource = ObjMovtos.DtResultados.FiltraParametros($"Saldo > 0 AND SaldoSubtotal > 0 {If(CveVenta < 0, "AND Tipo = 'Ant'", "")} {If(DdlTipoComprobante.SelectedValue = "Ant", "AND Tipo = 'NC'", "")}")
|
GVAnticipos.DataSource = ObjMovtos.DtResultados.FiltraParametros($"Saldo > 0 AND SaldoSubtotal > 0 {If(CveVenta < 0, $"AND Tipo = 'Ant'{If(DdlTipoComprobante.SelectedValue = "Ing", $" AND CveMoneda ={DdlMoneda.SelectedValue.ToEntero()}", "")} ", "")} {If(DdlTipoComprobante.SelectedValue = "Ant", "AND Tipo = 'NC'", "")}")
|
||||||
If ObjMovtos.DtResultados.SUM("Saldo", "Saldo > 0 AND SaldoSubtotal > 0 AND Tipo = 'Ant'") > 0 Then
|
If ObjMovtos.DtResultados.SUM("Saldo", "Saldo > 0 AND SaldoSubtotal > 0 AND Tipo = 'Ant'") > 0 Then
|
||||||
HdnTieneAnticipos.Value = "1"
|
HdnTieneAnticipos.Value = "1"
|
||||||
End If
|
End If
|
||||||
@@ -14624,6 +14624,7 @@ Partial Class Ventas
|
|||||||
TmpDT.Columns.Add("CveConcepto", GetType(Integer))
|
TmpDT.Columns.Add("CveConcepto", GetType(Integer))
|
||||||
|
|
||||||
TmpDT.Columns.Add("EsOutSourcing", GetType(Boolean))
|
TmpDT.Columns.Add("EsOutSourcing", GetType(Boolean))
|
||||||
|
TmpDT.Columns.Add("EsUsado", GetType(Boolean))
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CreaDTmpC()
|
Private Sub CreaDTmpC()
|
||||||
@@ -15711,7 +15712,8 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Return Not OcurrioError
|
Return Not OcurrioError
|
||||||
End Function
|
End Function
|
||||||
Private Function GenerarMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, DtMovDetalle As DataTable, CveAlmacen As Integer, ConceptoEntrada As Integer, CveMoneda As Integer, CveVenta As Integer, Optional MovimientoPrePoliza As Boolean = False, Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1, Optional AplicaMovimientoDetalleEntrada As Boolean = False) As Integer
|
Private Function GenerarMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, DtMovDetalle As DataTable, CveAlmacen As Integer, ConceptoEntrada As Integer, CveMoneda As Integer, CveVenta As Integer, Optional MovimientoPrePoliza As Boolean = False,
|
||||||
|
Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1, Optional AplicaMovimientoDetalleEntrada As Boolean = False, Optional ObjContPaq As ClsContPAQi = Nothing) As Integer
|
||||||
Dim OcurrioError As Boolean = False
|
Dim OcurrioError As Boolean = False
|
||||||
Dim ContadorMovtosDetalles = 0
|
Dim ContadorMovtosDetalles = 0
|
||||||
|
|
||||||
@@ -15780,6 +15782,7 @@ Partial Class Ventas
|
|||||||
'Agregamos las PrePolizas
|
'Agregamos las PrePolizas
|
||||||
If Not OcurrioError Then
|
If Not OcurrioError Then
|
||||||
If MovimientoPrePoliza AndAlso CveMovimientoInventario > 0 Then
|
If MovimientoPrePoliza AndAlso CveMovimientoInventario > 0 Then
|
||||||
|
'OcurrioError = Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoInventario, CveAlmacen)
|
||||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||||
Dim DtCostos = ObjInventario.DtResultados.Copy
|
Dim DtCostos = ObjInventario.DtResultados.Copy
|
||||||
Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"})
|
Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"})
|
||||||
@@ -15847,6 +15850,99 @@ Partial Class Ventas
|
|||||||
'Return Not OcurrioError
|
'Return Not OcurrioError
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
Private Function GeneraPrePolizaMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, ByRef ObjContPaq As ClsContPAQi, ObjFactura As Modelos.Factura, CvePrePoliza As Integer, CveMovimientoInventario As Integer, CveAlmacen As Integer) As Boolean
|
||||||
|
Dim OcurrioError As Boolean = False
|
||||||
|
Dim GenerarPrePolizaNueva As Boolean = False
|
||||||
|
Try
|
||||||
|
Dim DtCostos As DataTable = Nothing
|
||||||
|
Dim DtCostosDistinct As DataTable = Nothing
|
||||||
|
Dim IdCtaContable As Integer = 0
|
||||||
|
Dim CveCuenta As Integer = 0
|
||||||
|
Dim ValorInventario As Decimal = 0D
|
||||||
|
Dim TotalCostoAcumulado As Decimal = 0D
|
||||||
|
Dim Cont As Integer = 1
|
||||||
|
|
||||||
|
|
||||||
|
If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||||
|
DtCostos = ObjInventario.DtResultados.Copy
|
||||||
|
DtCostosDistinct = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"})
|
||||||
|
Else
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
If OcurrioError Then
|
||||||
|
Return Not OcurrioError
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL
|
||||||
|
|
||||||
|
If CvePrePoliza <= 0 Then
|
||||||
|
GenerarPrePolizaNueva = True
|
||||||
|
CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GeneraMovimientoAlmacen", ObjFactura.CvePlantillaPoliza, TotalCosto, TotalCosto, ObjFactura.CveMoneda, ObjFactura.Fecha, If(CveEmpresaCRM > 0, LblEmpresaCRM.Text, ObjFactura.Cliente.Nombre), ObjFactura.CveUsuario, UsuarioActual.CveEmpresa)
|
||||||
|
|
||||||
|
If CvePrePoliza <= 0 Then
|
||||||
|
OcurrioError = True
|
||||||
|
Return Not OcurrioError
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
For Each RowInv As DataRow In DtCostosDistinct.Rows
|
||||||
|
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL
|
||||||
|
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
|
||||||
|
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero
|
||||||
|
TotalCostoAcumulado += ValorInventario
|
||||||
|
|
||||||
|
'cuando es el último movimiento y hay diferencias en los importes
|
||||||
|
If Cont = DtCostosDistinct.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
|
||||||
|
ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Try
|
||||||
|
'If ValorInventario <> 0 Then
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
|
||||||
|
OcurrioError = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
'End If
|
||||||
|
Catch ex As Exception
|
||||||
|
OcurrioError = True
|
||||||
|
Alert("Error inesperado (15147). Por favor comuniquese con atención SIG.", TipoMensaje.ToastError)
|
||||||
|
End Try
|
||||||
|
Cont += 1
|
||||||
|
Next
|
||||||
|
|
||||||
|
If Not OcurrioError Then
|
||||||
|
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero
|
||||||
|
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If GenerarPrePolizaNueva Then
|
||||||
|
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
|
||||||
|
|
||||||
|
If UsuarioActual.CveEmpresa = 119 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "Egs", "Dev") Then
|
||||||
|
AutoConta = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
If AutoConta Then
|
||||||
|
If idCuentaContabilizacion > 0 Then
|
||||||
|
If Not ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then
|
||||||
|
Alert("Ocurrio un Error al contabilizar la prepoliza de almacen, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError)
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Alert(String.Format("Falta asignación de las siguientes cuentas contables: {0}", CuentasContablesInvalidas), TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al generar la prepoliza del movimiento de almacen", ex)
|
||||||
|
OcurrioError = True
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Not OcurrioError
|
||||||
|
End Function
|
||||||
Private Function GenerarMovimientoAlmacenVirtual(CveRemision As Integer, ByRef ObjInventario As ClsInventarios, ObjFactura As Modelos.Factura) As Boolean
|
Private Function GenerarMovimientoAlmacenVirtual(CveRemision As Integer, ByRef ObjInventario As ClsInventarios, ObjFactura As Modelos.Factura) As Boolean
|
||||||
Dim OcurrioError As Boolean = False
|
Dim OcurrioError As Boolean = False
|
||||||
|
|
||||||
@@ -19661,7 +19757,7 @@ Partial Class Ventas
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " CONTRATO DE CONSIGNACION DE VENTA - SURTIDO DE ALMACÉN "
|
#Region " CONTRATO DE CONSIGNACION DE VENTA - SURTIDO DE ALMACÉN "
|
||||||
Function RegistraAlmacenConsignacionVenta(ByRef ObjInventario As ClsInventarios, factura As Modelos.Factura) As Boolean
|
Function RegistraAlmacenConsignacionVenta(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, ObjContPaq As ClsContPAQi) As Boolean
|
||||||
If Not (UsuarioActual.Empresa.UsaInventarios AndAlso CveAlmacenExistenciasContrato > 0) Then
|
If Not (UsuarioActual.Empresa.UsaInventarios AndAlso CveAlmacenExistenciasContrato > 0) Then
|
||||||
Return True
|
Return True
|
||||||
End If
|
End If
|
||||||
@@ -19738,6 +19834,11 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'GENERAR PREPOLIZA
|
||||||
|
If Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoEntradaGeneral, CveAlmacenOrigenContrato) Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
@@ -21360,8 +21461,8 @@ Partial Class Ventas
|
|||||||
|
|
||||||
For Each Dr As DataRow In DtImpuestosLocal.Rows
|
For Each Dr As DataRow In DtImpuestosLocal.Rows
|
||||||
FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto"))
|
FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto"))
|
||||||
importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr) - TmpDT.SUM("Descuento", FiltroStr))).ToDecimal
|
importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr).ToDecimal() - TmpDT.SUM("Descuento", FiltroStr).ToDecimal()))
|
||||||
Dr("ImporteTotal") = importePuTemp.RoundSQL()
|
Dr("ImporteTotal") = importePuTemp.RoundSQL(2)
|
||||||
|
|
||||||
|
|
||||||
Dr("ImporteIEPS") = (importePuTemp * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
|
Dr("ImporteIEPS") = (importePuTemp * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
|
||||||
@@ -21374,7 +21475,7 @@ Partial Class Ventas
|
|||||||
'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2)
|
'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2)
|
||||||
'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2)
|
'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2)
|
||||||
'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2)
|
'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2)
|
||||||
Dr("ImportePU") = Dr("ImporteTotal").ToString.ToDecimal.RoundSQL(2) '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
|
Dr("ImportePU") = importePuTemp.RoundSQL(6) 'Dr("ImporteTotal").ToString.ToDecimal.RoundSQL(2) '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
@@ -21664,7 +21765,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Dim AplicaPUEditado As Boolean = UsuarioActual.TienePermisoProceso(253)
|
Dim AplicaPUEditado As Boolean = UsuarioActual.TienePermisoProceso(253)
|
||||||
|
|
||||||
Dim DtUsados As DataTable = TmpDT.FiltraParametros("CveClasificacion = 20519")
|
Dim DtUsados As DataTable = TmpDT.FiltraParametros("EsUsado = True")
|
||||||
|
|
||||||
TmpDT.Clear()
|
TmpDT.Clear()
|
||||||
For Each Gv As GridViewRow In GvAplicaDevolucion.Rows
|
For Each Gv As GridViewRow In GvAplicaDevolucion.Rows
|
||||||
@@ -24027,9 +24128,11 @@ Partial Class Ventas
|
|||||||
Else
|
Else
|
||||||
Row("PorcentajeIVA") = DrPS("IVA")
|
Row("PorcentajeIVA") = DrPS("IVA")
|
||||||
End If
|
End If
|
||||||
Dim TotalCalculableImpuestos = (Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble) - Row("Descuento").ToString.ToDouble
|
Dim TotalCalculableImpuestos As Decimal = (Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal) - Row("Descuento").ToString.ToDecimal
|
||||||
|
Dim TotalCalculableImpuestosIVA As Decimal = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString.ToDecimal)
|
||||||
|
|
||||||
Row("IVA") = Row("PorcentajeIVA").ToString.ToDouble
|
Row("IVA") = Row("PorcentajeIVA").ToString.ToDouble
|
||||||
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDouble * TotalCalculableImpuestos, NumeroDecimales)
|
Row("ImporteIVA") = (Row("PorcentajeIVA").ToString.ToDouble * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Row("IVA") = 0
|
Row("IVA") = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user