Correcion en punto de venta de recepcion de usados
This commit is contained in:
@@ -337,6 +337,7 @@
|
||||
<asp:DropDownList CssClass="form-control input-sm" ID="DdlTipoComprobante" DataValueField="CveTipoDocumento" DataTextField="TipoDocumento" runat="server" AppendDataBoundItems="true" AutoPostBack="true" Width="100px">
|
||||
<asp:ListItem Value="Ing" Text="Ingresos" Selected="True"></asp:ListItem>
|
||||
<asp:ListItem Value="Ant" Text="Anticipos"></asp:ListItem>
|
||||
<asp:ListItem Value="Rem" Text="Remision"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
|
||||
</td>
|
||||
@@ -1208,7 +1209,7 @@
|
||||
<ajax:FilteredTextBoxExtender ID="FTBECambio" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
|
||||
<br></br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1503,7 +1504,7 @@
|
||||
<asp:Literal ID="LtlRecepcionUsados" Text="Recepcion Usados" runat="server"> </asp:Literal></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<asp:GridView ID="GvRecepcionUsados" runat="server" GridLines="None" ShowHeaderWhenEmpty="true" CssClass="table table-hover table-striped ScrollAD mysmallbtn" Width="100%" data-sort="true" AutoGenerateColumns="False"
|
||||
<asp:GridView ID="GvRecepcionUsadosModal" runat="server" GridLines="None" ShowHeaderWhenEmpty="true" CssClass="table table-hover table-striped ScrollAD mysmallbtn" Width="100%" data-sort="true" AutoGenerateColumns="False"
|
||||
DataKeyNames="CvePSCargo,CveUM,Cargo">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="CodigoPS" HeaderText="Producto/Servicio" ItemStyle-HorizontalAlign="Left" />
|
||||
@@ -2620,7 +2621,7 @@
|
||||
<asp:HiddenField ID="HdnPorcentajeIEPS" runat="server" Value="-1" />
|
||||
<asp:HiddenField ID="HdnCvePS" runat="server" Value="-1" />
|
||||
|
||||
<div class="row">
|
||||
<div class="row" runat="server" visible="false">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlClasificacion" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="100%" OnSelectedIndexChanged="DdlClasificacion_SelectedIndexChanged">
|
||||
@@ -2643,7 +2644,7 @@
|
||||
<br />
|
||||
<asp:UpdatePanel runat="server" ID="UpUnidadMedida" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<div runat="server" visible="false" class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlUnidadMedida" AppendDataBoundItems="true" CssClass="form-control input-sm select2me " runat="server" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida" Style="width: 100%;"></asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVUnidadMedida" runat="server" ControlToValidate="DdlUnidadMedida" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Unidad de Medida''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEUnidadMedida" runat="server" HighlightCssClass="vco" TargetControlID="RFVUnidadMedida" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
@@ -2653,12 +2654,30 @@
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<br />
|
||||
<div>
|
||||
<label>Observación:</label>
|
||||
<br />
|
||||
<asp:TextBox ID="TxtObsPS" runat="server" Height="50" Width="398px" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<label>Observación:</label>
|
||||
<br />
|
||||
<asp:TextBox ID="TxtObsPS" runat="server" Height="100%" Width="100%" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
|
||||
</div>
|
||||
<div class="col-md-5" id="DivRecepcionUsados" runat="server" visible="false">
|
||||
<asp:GridView ID="GvRecepcionUsados" runat="server" GridLines="None" ShowHeaderWhenEmpty="true" CssClass="table table-hover table-striped ScrollAD mysmallbtn"
|
||||
data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-height="100"
|
||||
DataKeyNames="CvePSCargo,CveUM,Cargo,CveTamaño">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="CodigoPS" HeaderText="Tamaño" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="70%" />
|
||||
<asp:TemplateField HeaderText="Cantidad" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="30%" >
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtCantidad" runat="server" Width="80%"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender ID="FTBECantidad" runat="server" TargetControlID="TxtCantidad" FilterType="Custom, Numbers" ValidChars="." />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtPrecio" runat="server" onkeypress="setFocus(event,'LbAgregar');" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="76px" CssClass="form-control "></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
|
||||
@@ -2729,7 +2748,7 @@
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtPUFactura" CssClass="form-control" runat="server" MaxLength="50" ></asp:TextBox>
|
||||
<asp:TextBox ID="TxtPUFactura" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVPUFactura" runat="server" ControlToValidate="TxtPUFactura" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''PU Factura''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEPUFactura" runat="server" HighlightCssClass="vco" TargetControlID="RFVPUFactura"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:FilteredTextBoxExtender ID="FTBEPUFactura" runat="server" TargetControlID="TxtPUFactura" FilterType="Custom, Numbers" ValidChars=".," />
|
||||
@@ -3522,7 +3541,7 @@
|
||||
function CambiaAjuste(txt, txtajuste) {
|
||||
Recalcula();
|
||||
if (txtajuste != null) {
|
||||
txtajuste.value = ToDouble(txt.value)
|
||||
txtajuste.value = ToDouble(txt.value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ Option Strict On
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports System.IO
|
||||
Imports System.Xml
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports System.Linq
|
||||
Imports System.Security.Cryptography.X509Certificates
|
||||
Imports System.Globalization
|
||||
|
||||
@@ -1955,9 +1954,10 @@ Partial Class PV
|
||||
|
||||
Dim DbRow As DataRow = Nothing
|
||||
DbRow = TmpDT.Rows(e.RowIndex)
|
||||
TmpDT.Rows.Remove(DbRow)
|
||||
|
||||
CalculaUsados()
|
||||
EliminarUsados(DbRow("Consec").ToString().ToEntero())
|
||||
|
||||
TmpDT.Rows.Remove(DbRow)
|
||||
|
||||
GvPS.DataSource = TmpDT
|
||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||
@@ -2256,22 +2256,18 @@ Partial Class PV
|
||||
MandarCorreoSupervisor = False
|
||||
End If
|
||||
|
||||
'If DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
' EmitirImprimirNew()
|
||||
'If TmpDTAjustes IsNot Nothing AndAlso Not TmpDTAjustes.Rows.Count > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531).ToString = "1" Then
|
||||
' RegistraScript("$('#DModalRecepcionUsados').modal('show');")
|
||||
'Else
|
||||
' LimpiaEscondeContado()
|
||||
' EmitirImprimirNew()
|
||||
'End If
|
||||
EmitirImprimirNew()
|
||||
|
||||
If TmpDTAjustes IsNot Nothing AndAlso Not TmpDTAjustes.Rows.Count > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(531).ToString = "1" Then
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DModalRecepcionUsados"))
|
||||
Else
|
||||
EmitirImprimirNew()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region " NNNNEEEEEEEWWWWWW "
|
||||
#Region "E M I T I R - F A C T U R A"
|
||||
Protected Sub EmitirImprimirNew()
|
||||
|
||||
If ValidaPagosContado() Then
|
||||
@@ -2293,12 +2289,6 @@ Partial Class PV
|
||||
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV))
|
||||
Next
|
||||
|
||||
|
||||
' 'MUESTA ALERT OK
|
||||
' Dim Liga = If(UsuarioActual.CveRol = 1165, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={CveCliente}&Opt=3"";")
|
||||
' Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion, Liga)
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -2499,12 +2489,12 @@ Partial Class PV
|
||||
ddlAlmacen.SelectedIndex = 1
|
||||
End If
|
||||
|
||||
ObjFactura.CveAlmacen = ddlAlmacen.SelectedValue.ToEntero
|
||||
'ObjFactura.CveAlmacen = ddlAlmacen.SelectedValue.ToEntero
|
||||
|
||||
DtInv.Columns.Add("Seleccionado", GetType(Integer))
|
||||
For Each Gvr As GridViewRow In GvInv.Rows
|
||||
Dim Dr As DataRow = DtInv.Select($"CvePS={Gvr.DataKey("CvePS")}")(0)
|
||||
If Gvr.FCCheckBox("cbInv").Checked Then
|
||||
If Gvr.FCCheckBox("cbInv").Checked AndAlso ddlAlmacen.SelectedValue.ToEntero > 0 Then
|
||||
Dr("Seleccionado") = 1
|
||||
Else
|
||||
Dr("Seleccionado") = 0
|
||||
@@ -2512,7 +2502,7 @@ Partial Class PV
|
||||
Next
|
||||
DtInv.AcceptChanges()
|
||||
|
||||
ObjFactura.DtInventario = DtInv.FiltraParametros("Seleccionado = 1")
|
||||
'ObjFactura.DtInventario = DtInv.FiltraParametros("Seleccionado = 1")
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -2717,6 +2707,11 @@ Partial Class PV
|
||||
HdnTipoInv.Value = drPS("Inv_CveMetodoInventario").ToString
|
||||
HdnAplicaIEPS.Value = drPS("AplicaIEPS").ToString
|
||||
HdnPorcentajeIEPS.Value = drPS("IEPSPorcentaje").ToString
|
||||
'Muestra la tabla de tamaños
|
||||
If drPS("CveTamaño").ToString().ToEntero() > 0 Then
|
||||
DivRecepcionUsados.Visible = True
|
||||
End If
|
||||
|
||||
DdlUnidadMedida.Items.Clear()
|
||||
If UsuarioActual.Empresa.UsaInventarios Then
|
||||
DdlUnidadMedida.DataSource = GlobalDTProductosServiciosEquivalencias(CvePSParametro, -1)
|
||||
@@ -2791,7 +2786,7 @@ Partial Class PV
|
||||
UpClasificacion.Update()
|
||||
UpPS.Update()
|
||||
UpUnidadMedida.Update()
|
||||
|
||||
UpAddVenta.Update()
|
||||
End Sub
|
||||
Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange
|
||||
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero, DdlPS)
|
||||
@@ -2980,6 +2975,9 @@ Partial Class PV
|
||||
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
|
||||
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
|
||||
|
||||
TmpDT.Columns.Add("PUOriginal", GetType(Decimal))
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CreaDTmpC()
|
||||
@@ -3152,6 +3150,13 @@ Partial Class PV
|
||||
|
||||
ChkAgregar.Checked = True
|
||||
|
||||
For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
|
||||
If Gvr.RowType = DataControlRowType.DataRow Then
|
||||
Gvr.FCTextBox("TxtCantidad").Text = ""
|
||||
End If
|
||||
Next
|
||||
DivRecepcionUsados.Visible = False
|
||||
|
||||
LimpiaAjuste()
|
||||
|
||||
UPPDescuento.Update()
|
||||
@@ -3164,17 +3169,19 @@ Partial Class PV
|
||||
Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0,
|
||||
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
|
||||
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
|
||||
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False) As Boolean
|
||||
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False) As Integer
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
Dim Retorno As Integer = -1
|
||||
If Not CvePS > 0 Then
|
||||
Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
Retorno = -1
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
If (Obs.Length + PS.Length > 1000) Then
|
||||
Alert(String.Format("El Nombre y observación del producto tiene longitud de {0} caracteres y excede los 1000 caracteres permitidos.", Obs.Length + PS.Length), TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
Retorno = -1
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
'VALIDA CONCEPTOS EN CERO - YA SE VALIDA ANTES CON FUNCIONALIDAD - A MIRAS DE ELIMINAR - IPP 28 AGOSTO 2017
|
||||
@@ -3183,153 +3190,19 @@ Partial Class PV
|
||||
If Cantidad * PU <= 0 Then
|
||||
If Not DdlTipoComprobante.SelectedValue = "DPe" Then
|
||||
Alert("El importe del concepto debe ser mayor a cero. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
Retorno = -1
|
||||
Return Retorno
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Dim Row As DataRow = Nothing
|
||||
|
||||
If Modalidad = "A" Then
|
||||
Dim Row As DataRow = Nothing
|
||||
Dim TotalCalculableImpuestos As Decimal = 0
|
||||
PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos
|
||||
|
||||
Row = TmpDT.NewRow()
|
||||
Row("CveProyecto") = CveProyecto
|
||||
Row("Proyecto") = Proyecto
|
||||
Row("CveSubProyecto") = CveSubProyecto
|
||||
Row("SubProyecto") = SubProyecto
|
||||
Row("SerieLote") = SerieLote
|
||||
Row("TiempoEntrega") = TiempoEntrega
|
||||
Row("Orden") = TmpDT.Rows.Count + 1
|
||||
Row("Cantidad") = Cantidad
|
||||
Row("CveUM") = CveUM
|
||||
Row("UM") = UM
|
||||
Row("CveClasificacion") = CveClasificacion
|
||||
Row("Clasificacion") = Clasificacion
|
||||
Row("CvePS") = CvePS
|
||||
Row("Obs") = Obs
|
||||
|
||||
|
||||
|
||||
Dim DrPS As DataRow = Nothing
|
||||
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
|
||||
|
||||
If Not ClienteDesglosaIEPS Then
|
||||
If Not RegeneraIEPS Then
|
||||
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal)
|
||||
End If
|
||||
DrPS("IEPSPorcentaje") = 0
|
||||
End If
|
||||
|
||||
'verifica si tiene ventaminima
|
||||
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then
|
||||
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
|
||||
If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then
|
||||
Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString))
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
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")
|
||||
Row("Consec") = TmpDT.Rows.Count + 1
|
||||
If Not EsCargo Then
|
||||
ConsecutivoVenta = 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")
|
||||
|
||||
If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion")
|
||||
If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion")
|
||||
|
||||
If DrPS("IVA").ToString.Contiene("-1", "") Then
|
||||
Row("PorcentajeIVA") = SubProyectoPorcentajeIVA
|
||||
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("AsientoContableVentas") = DrPS("AsientoContableVentas")
|
||||
' Row("IdCtaContVentas") = IdCtaContable
|
||||
' Row("AplicaParaConcepto") = AplicaParaConcepto
|
||||
|
||||
Row("SATClaveProdServ") = DrPS("SATClavePS")
|
||||
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
|
||||
|
||||
|
||||
Row("EntregaDirecta") = EntregaDirecta
|
||||
'Contratos
|
||||
Row("CveContratoDetalle") = CveContratoDetalle
|
||||
Row("CveVentaDetalle") = CveVentaDetalle
|
||||
Row("CveMovimientoDetallePedido") = CveVentaDetalle
|
||||
Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
|
||||
Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
|
||||
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
|
||||
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
|
||||
Row("CuentaPredial") = CuentaPredial
|
||||
Row("EsCargo") = EsCargo
|
||||
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
|
||||
|
||||
'MONEDA DIFERENTE DEL PS AL PRIMER PS AGREGADO
|
||||
If DdlMoneda.Enabled = False And CveVenta < 0 And TmpDT.Rows.Count > 0 Then
|
||||
If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString Then
|
||||
Alert($"La moneda base del producto: <b>{DrPS("PSCodigo").ToString}</b> es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
'ACTIVA PRODUCTOS DE LA MISMA MONEDA
|
||||
If TmpDT.Rows.Count = 0 And CveVenta < 0 Then
|
||||
DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString)
|
||||
CambiaMoneda()
|
||||
DdlMoneda.Enabled = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'RECARGAR GV
|
||||
TmpDT.Rows.Add(Row)
|
||||
|
||||
ElseIf Modalidad = "U" Then
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = 0
|
||||
PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos
|
||||
Dim Contador As Integer = 0
|
||||
For Each Dr As DataRow In TmpDT.Rows
|
||||
If Dr("Consec").ToString.ToEntero = Index Then
|
||||
@@ -3337,135 +3210,157 @@ Partial Class PV
|
||||
End If
|
||||
Contador = Contador + 1
|
||||
Next
|
||||
Dim Row As DataRow = TmpDT.Rows(Contador)
|
||||
Row("CveProyecto") = CveProyecto
|
||||
Row("Proyecto") = Proyecto
|
||||
Row("CveSubProyecto") = CveSubProyecto
|
||||
Row("SubProyecto") = SubProyecto
|
||||
Row("SerieLote") = SerieLote
|
||||
Row("TiempoEntrega") = TiempoEntrega
|
||||
Row("Orden") = TmpDT.Rows.Count + 1
|
||||
Row("Cantidad") = Cantidad
|
||||
Row("CveUM") = CveUM
|
||||
Row("UM") = UM
|
||||
Row("CveClasificacion") = CveClasificacion
|
||||
Row("Clasificacion") = Clasificacion
|
||||
Row("CvePS") = CvePS
|
||||
Row("Obs") = Obs
|
||||
Row = TmpDT.Rows(Contador)
|
||||
End If
|
||||
|
||||
Dim DrPS As DataRow = Nothing
|
||||
Dim TotalCalculableImpuestos As Decimal = 0
|
||||
PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos
|
||||
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
|
||||
Row("CveProyecto") = CveProyecto
|
||||
Row("Proyecto") = Proyecto
|
||||
Row("CveSubProyecto") = CveSubProyecto
|
||||
Row("SubProyecto") = SubProyecto
|
||||
Row("SerieLote") = SerieLote
|
||||
Row("TiempoEntrega") = TiempoEntrega
|
||||
Row("Orden") = TmpDT.Rows.Count + 1
|
||||
Row("Cantidad") = Cantidad
|
||||
Row("CveUM") = CveUM
|
||||
Row("UM") = UM
|
||||
Row("CveClasificacion") = CveClasificacion
|
||||
Row("Clasificacion") = Clasificacion
|
||||
Row("CvePS") = CvePS
|
||||
Row("Obs") = Obs
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = -1
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
If Not ClienteDesglosaIEPS Then
|
||||
If Not RegeneraIEPS Then
|
||||
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal)
|
||||
End If
|
||||
DrPS("IEPSPorcentaje") = 0
|
||||
End If
|
||||
|
||||
|
||||
If Not ClienteDesglosaIEPS Then
|
||||
If Not RegeneraIEPS Then
|
||||
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal)
|
||||
End If
|
||||
DrPS("IEPSPorcentaje") = 0
|
||||
'verifica si tiene ventaminima
|
||||
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then
|
||||
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
|
||||
If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then
|
||||
Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString))
|
||||
Retorno = -1
|
||||
Return Retorno
|
||||
End If
|
||||
End If
|
||||
|
||||
'verifica si tiene ventaminima
|
||||
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then
|
||||
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
|
||||
If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then
|
||||
Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString))
|
||||
Return False
|
||||
End If
|
||||
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
|
||||
|
||||
If Modalidad = "A" Then
|
||||
If Not TmpDT.Columns.Contains("PUOriginal") Then
|
||||
TmpDT.Columns.Add("PUOriginal", GetType(Decimal))
|
||||
End If
|
||||
Row("PUOriginal") = PU
|
||||
End If
|
||||
|
||||
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")
|
||||
|
||||
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 = "A" Then
|
||||
Row("Consec") = TmpDT.Rows.Count + 1
|
||||
If Not EsCargo Then
|
||||
ConsecutivoVenta = TmpDT.Rows.Count + 1
|
||||
End If
|
||||
ElseIf Modalidad = "U" Then
|
||||
If Not EsCargo Then
|
||||
ConsecutivoVenta = Row("Consec").ToString.ToEntero
|
||||
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")
|
||||
|
||||
If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion")
|
||||
If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion")
|
||||
|
||||
If DrPS("IVA").ToString.Contiene("-1", "") Then
|
||||
Row("PorcentajeIVA") = SubProyectoPorcentajeIVA
|
||||
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("AsientoContableVentas") = DrPS("AsientoContableVentas")
|
||||
' Row("IdCtaContVentas") = IdCtaContable
|
||||
' Row("AplicaParaConcepto") = AplicaParaConcepto
|
||||
|
||||
Row("SATClaveProdServ") = DrPS("SATClavePS")
|
||||
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
|
||||
|
||||
|
||||
Row("EntregaDirecta") = EntregaDirecta
|
||||
'Contratos
|
||||
Row("CveContratoDetalle") = CveContratoDetalle
|
||||
Row("CveVentaDetalle") = CveVentaDetalle
|
||||
Row("CveMovimientoDetallePedido") = CveVentaDetalle
|
||||
Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
|
||||
Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
|
||||
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
|
||||
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
|
||||
Row("CuentaPredial") = CuentaPredial
|
||||
Row("EsCargo") = EsCargo
|
||||
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
|
||||
|
||||
'MONEDA DIFERENTE DEL PS AL PRIMER PS AGREGADO
|
||||
If DdlMoneda.Enabled = False And CveVenta < 0 And TmpDT.Rows.Count > 0 Then
|
||||
If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString Then
|
||||
Alert($"La moneda base del producto: <b>{DrPS("PSCodigo").ToString}</b> es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
'ACTIVA PRODUCTOS DE LA MISMA MONEDA
|
||||
If TmpDT.Rows.Count = 0 And CveVenta < 0 Then
|
||||
DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString)
|
||||
CambiaMoneda()
|
||||
DdlMoneda.Enabled = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
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")
|
||||
|
||||
If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion")
|
||||
If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion")
|
||||
|
||||
If DrPS("IVA").ToString.Contiene("-1", "") Then
|
||||
Row("PorcentajeIVA") = SubProyectoPorcentajeIVA
|
||||
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("AsientoContableVentas") = DrPS("AsientoContableVentas")
|
||||
' Row("IdCtaContVentas") = IdCtaContable
|
||||
' Row("AplicaParaConcepto") = AplicaParaConcepto
|
||||
|
||||
Row("SATClaveProdServ") = DrPS("SATClavePS")
|
||||
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
|
||||
|
||||
|
||||
Row("EntregaDirecta") = EntregaDirecta
|
||||
'Contratos
|
||||
Row("CveContratoDetalle") = CveContratoDetalle
|
||||
Row("CveVentaDetalle") = CveVentaDetalle
|
||||
Row("CveMovimientoDetallePedido") = CveVentaDetalle
|
||||
Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
|
||||
Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
|
||||
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
|
||||
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
|
||||
Row("CuentaPredial") = CuentaPredial
|
||||
Row("EsCargo") = EsCargo
|
||||
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
|
||||
|
||||
'MONEDA DIFERENTE DEL PS AL PRIMER PS AGREGADO
|
||||
If DdlMoneda.Enabled = False And CveVenta < 0 And TmpDT.Rows.Count > 0 Then
|
||||
If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString Then
|
||||
Alert($"La moneda base del producto: <b>{DrPS("PSCodigo").ToString}</b> es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = -1
|
||||
Return Retorno
|
||||
End If
|
||||
End If
|
||||
|
||||
'ACTIVA PRODUCTOS DE LA MISMA MONEDA
|
||||
If TmpDT.Rows.Count = 0 And CveVenta < 0 Then
|
||||
DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString)
|
||||
CambiaMoneda()
|
||||
DdlMoneda.Enabled = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Modalidad = "A" Then
|
||||
TmpDT.Rows.Add(Row)
|
||||
End If
|
||||
|
||||
Retorno = Row("Consec").ToString().ToEntero()
|
||||
|
||||
TmpDT.AcceptChanges()
|
||||
Retorno = True
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Private Function ValidaAgregarPS(CvePS As Integer, CveUM As Integer, PU As Double, CveTipoPS As Integer) As Boolean 'NO TOCAR - IPP
|
||||
@@ -3493,6 +3388,18 @@ Partial Class PV
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim CantidadUsados As Decimal = 0
|
||||
For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
|
||||
If Gvr.RowType = DataControlRowType.DataRow Then
|
||||
CantidadUsados = CantidadUsados + Gvr.FCTextBox("TxtCantidad").Text.ToEntero()
|
||||
End If
|
||||
Next
|
||||
|
||||
If CantidadUsados > TxtCantidad.Text.ToEntero() Then
|
||||
Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
|
||||
'VALIDA PROMOCIONES
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetPromocionesPS(-1, TxtFecha.Text.ToDateTime, DdlSubProyectoDatos.SelectedValue.ToEntero, CveCliente, DdlVendedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
@@ -3704,30 +3611,22 @@ Partial Class PV
|
||||
Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero
|
||||
Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString
|
||||
|
||||
AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
|
||||
|
||||
Dim Consec = AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
|
||||
CvePS, "", TxtObsPS.Text.Trim, If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal), Descuento,
|
||||
CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text,
|
||||
SerieLote:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS)
|
||||
|
||||
CalculaUsados()
|
||||
Dim ListaPSCargo = CalculaUsados(Consec)
|
||||
If ListaPSCargo.Count > 0 Then
|
||||
CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
''NO SIRVE PARA NADA - NO SE USAN LAS VARIABLES - IPP 28 AGOSTO 2017
|
||||
'For Each gvr As GridViewRow In GVAnticipos.Rows
|
||||
' Dim total As Decimal = TxtTotal.Text.ToString.ToDecimal
|
||||
' Dim saldo As Decimal = gvr.DataKey("Saldo").ToDecimal
|
||||
' Dim maxsaldo As Decimal
|
||||
' If total > saldo Then
|
||||
' maxsaldo = saldo
|
||||
' Else
|
||||
' maxsaldo = total
|
||||
' End If
|
||||
'Next
|
||||
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
@@ -4909,7 +4808,7 @@ Partial Class PV
|
||||
DdlFolioGarantia.DataSource = ObjAcum.DtResultados
|
||||
DdlFolioGarantia.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End If
|
||||
|
||||
ObjAcum.Dispose()
|
||||
|
||||
DdlFacturas.Items.Insert(0, New ListItem("Sin Factura", "-1"))
|
||||
|
||||
@@ -4919,14 +4818,17 @@ Partial Class PV
|
||||
DdlTipoDefecto.DataSource = GlobalDTAcumTiposDefecto.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa}")
|
||||
DdlTipoDefecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
|
||||
GvRecepcionUsados.DataSource = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo > 0")
|
||||
Dim DtTamanios = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo > 0")
|
||||
|
||||
GvRecepcionUsados.DataSource = DtTamanios
|
||||
GvRecepcionUsadosModal.DataSource = DtTamanios
|
||||
|
||||
ObjAcum.Dispose()
|
||||
DdlFolioGarantia.DataBind()
|
||||
DdlTipoUso.DataBind()
|
||||
DdlTipoDefecto.DataBind()
|
||||
GvRecepcionUsados.DataBind()
|
||||
DdlFacturas.DataBind()
|
||||
GvRecepcionUsados.DataBind()
|
||||
GvRecepcionUsadosModal.DataBind()
|
||||
|
||||
CargaPSAjuste()
|
||||
|
||||
@@ -4934,8 +4836,6 @@ Partial Class PV
|
||||
CreaDTmpDTRecepcionUsados()
|
||||
|
||||
DivChkAjuste.Visible = True
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaPSAjuste()
|
||||
@@ -5276,6 +5176,7 @@ Partial Class PV
|
||||
Private Sub CreaDTmpDTRecepcionUsados()
|
||||
TmpDTRecepcionUsados = New DataTable
|
||||
TmpDTRecepcionUsados.Columns.Add("CvePS", GetType(Integer))
|
||||
TmpDTRecepcionUsados.Columns.Add("CvePSRelacionado", GetType(Integer))
|
||||
TmpDTRecepcionUsados.Columns.Add("Cantidad", GetType(Decimal))
|
||||
TmpDTRecepcionUsados.Columns.Add("CveUM", GetType(Integer))
|
||||
TmpDTRecepcionUsados.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
@@ -5283,34 +5184,66 @@ Partial Class PV
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnRecepcionUsados_Click(sender As Object, e As EventArgs)
|
||||
TmpDTRecepcionUsados.Clear()
|
||||
TmpDTRecepcionUsados.AcceptChanges()
|
||||
|
||||
'CalculaRecepcionUsados(GvRecepcionUsadosModal)
|
||||
RegistraScript("$('#DModalRecepcionUsados').modal('hide');")
|
||||
|
||||
EmitirImprimirNew()
|
||||
End Sub
|
||||
Private Sub CalculaRecepcionUsados(Gv As GridView, CvePS As Integer, ListaPSCargo As List(Of Integer))
|
||||
|
||||
If Modalidad = "U" Then
|
||||
If TmpDTRecepcionUsados.Rows.Count > 0 Then
|
||||
Dim Elimino As Boolean = False
|
||||
For Each Row As DataRow In TmpDTRecepcionUsados.Rows
|
||||
If Row("CvePSRelacionado").ToString().ToEntero() = CvePS Then
|
||||
Row.Delete()
|
||||
Elimino = True
|
||||
End If
|
||||
Next
|
||||
If Elimino Then
|
||||
TmpDTRecepcionUsados.AcceptChanges()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim TotalCargos As Decimal = 0
|
||||
Dim TotalCantidad As Decimal = 0
|
||||
For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
|
||||
If Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then
|
||||
TotalCargos += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal * Gvr.DataKey("Cargo").ToDecimal
|
||||
TotalCantidad += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
|
||||
For Each Gvr As GridViewRow In Gv.Rows
|
||||
If Gvr.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
Dim Row As DataRow = TmpDTRecepcionUsados.NewRow()
|
||||
Row("CvePS") = Gvr.DataKey("CvePSCargo").ToEntero
|
||||
Row("Cantidad") = Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
|
||||
Row("CveUM") = Gvr.DataKey("CveUM").ToEntero
|
||||
Row("CveVentaDetalle") = -1
|
||||
Row("PU") = Gvr.DataKey("Cargo").ToDouble
|
||||
TmpDTRecepcionUsados.Rows.Add(Row)
|
||||
If Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then
|
||||
TotalCargos += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal * Gvr.DataKey("Cargo").ToDecimal
|
||||
TotalCantidad += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
|
||||
|
||||
Dim Row As DataRow = TmpDTRecepcionUsados.NewRow()
|
||||
Row("CvePS") = Gvr.DataKey("CvePSCargo").ToEntero
|
||||
Row("CvePSRelacionado") = CvePS
|
||||
Row("Cantidad") = Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
|
||||
Row("CveUM") = Gvr.DataKey("CveUM").ToEntero
|
||||
Row("CveVentaDetalle") = -1
|
||||
Row("PU") = Gvr.DataKey("Cargo").ToDouble
|
||||
TmpDTRecepcionUsados.Rows.Add(Row)
|
||||
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
If TotalCantidad > TmpDT.FiltraParametros("EsCargo = True").SUMD("Cantidad") Then
|
||||
Dim StrCargos As New StringBuilder
|
||||
For Each CvePSCargo As Integer In ListaPSCargo
|
||||
StrCargos.AppendFormat("{0},", CvePSCargo)
|
||||
Next
|
||||
StrCargos.Remove(StrCargos.Length - 1, 1)
|
||||
|
||||
If TotalCantidad > TmpDT.FiltraParametros($"EsCargo = True AND CvePS IN ({StrCargos})").SUMD("Cantidad") Then
|
||||
Dim drt As DataRow() = TmpDT.Select("CvePS = " & CvePS)
|
||||
TmpDT.Rows.Remove(drt(0))
|
||||
|
||||
Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
For Each Dr As DataRow In TmpDT.FiltraParametros("EsCargo = True").Rows
|
||||
|
||||
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND CvePS IN ({StrCargos})").Rows
|
||||
|
||||
Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
||||
Dim PUActual As Decimal = (TotalAnterior - TotalCargos) / Dr("Cantidad").ToString.ToDecimal
|
||||
@@ -5342,8 +5275,7 @@ Partial Class PV
|
||||
Next
|
||||
TmpDT.AcceptChanges()
|
||||
If TotalCargos > 0 Then ' cuando se entrega más valor de usados, que los cargos hechos, se descuenta sobre el PU del producto de venta
|
||||
For Each Dr As DataRow In TmpDT.FiltraParametros("EsCargo = False").Rows
|
||||
|
||||
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = False AND CvePS={CvePS}").Rows
|
||||
|
||||
Dim PUAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
||||
Dim PUActual As Decimal = PUAnterior - (TotalCargos / Dr("Cantidad").ToString.ToDecimal)
|
||||
@@ -5365,7 +5297,6 @@ Partial Class PV
|
||||
drr("IEPS") = Dr("ImporteIEPS")
|
||||
drr("Total") = (Dr("Cantidad").ToString.ToDecimal * PUActual)
|
||||
drr("TotalImporte") = Math.Round(Dr("Cantidad").ToString.ToDecimal * PUActual, NumeroDecimales)
|
||||
|
||||
End If
|
||||
|
||||
If TotalCargos <= 0 Then
|
||||
@@ -5380,15 +5311,14 @@ Partial Class PV
|
||||
TmpDTRecepcionUsados.AcceptChanges()
|
||||
|
||||
CalculaTotalesVenta()
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DModalRecepcionUsados"))
|
||||
|
||||
EmitirImprimirNew()
|
||||
End Sub
|
||||
Private Sub CalculaUsados()
|
||||
Private Function CalculaUsados(Consec As Integer) As List(Of Integer)
|
||||
|
||||
'If Modalidad = "U" Then
|
||||
' EliminarUsados(Consec)
|
||||
'End If
|
||||
|
||||
'If ClienteEsDistribuidor Then
|
||||
Dim ListaPScargo As New List(Of Integer)
|
||||
|
||||
Dim DTTamanios As New DataTable
|
||||
Dim ObjAcum As New ClsAcumuladores
|
||||
@@ -5396,35 +5326,8 @@ Partial Class PV
|
||||
If ObjAcum.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
DTTamanios = ObjAcum.DtResultados
|
||||
Dim DTCvePSCostos = ObjAcum.DtResultados.FiltraParametros("", "", {"CvePSCargo"})
|
||||
|
||||
Dim DTCvePSCostos As New DataTable
|
||||
DTCvePSCostos = ObjAcum.DtResultados.FiltraParametros("", "", {"CvePSCargo"})
|
||||
|
||||
If Not TmpDT.Columns.Contains("Eliminar") Then
|
||||
TmpDT.Columns.Add("Eliminar", GetType(Integer))
|
||||
End If
|
||||
|
||||
For Each drow As DataRow In TmpDT.Rows
|
||||
For Each drow2 As DataRow In DTCvePSCostos.Rows
|
||||
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
|
||||
drow("Eliminar") = 1
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
Dim TmpDTView As New DataView(TmpDT)
|
||||
TmpDTView.RowFilter = "Eliminar = 1"
|
||||
|
||||
For Each dRowEliminar As DataRowView In TmpDTView
|
||||
dRowEliminar.Delete()
|
||||
|
||||
Next
|
||||
|
||||
|
||||
TmpDT.AcceptChanges()
|
||||
|
||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||
|
||||
Dim CveUnidadMedidaPSA As Integer = -1
|
||||
Dim UnidadMedidaPSA As String = "Unidad"
|
||||
@@ -5438,7 +5341,7 @@ Partial Class PV
|
||||
Dim PSPSA As String = ""
|
||||
|
||||
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
||||
'AgregarProductoServicio(1, CveUnidadMedidaPSA, UnidadMedidaPSA, CveClacificacionPSA, ClacificacionPSA, CvePSPSA, PSPSA, "", ImporteCargo, 0, -1, "", CveSubProyectoPSA, SubProyectoPSA)
|
||||
|
||||
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("UnidadMedida", GetType(String))
|
||||
@@ -5450,7 +5353,9 @@ Partial Class PV
|
||||
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
|
||||
|
||||
For Each DrowPartidas As DataRow In TmpDT.Rows
|
||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||
For Each DrowPartidas As DataRow In TmpDT.Select($"Consec = {Consec}")
|
||||
|
||||
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
|
||||
|
||||
If CveTamanioTemp > 0 Then
|
||||
@@ -5512,25 +5417,74 @@ Partial Class PV
|
||||
|
||||
End If
|
||||
Next
|
||||
ObjProductosServicios.Dispose()
|
||||
|
||||
Dim ModalidadBack = Modalidad
|
||||
'CAMBIA LA MODALIDAD PARA AGREGAR LOS PS CARGO
|
||||
If Modalidad = "U" Then
|
||||
Modalidad = "A"
|
||||
End If
|
||||
|
||||
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
||||
Modalidad = "A"
|
||||
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
|
||||
AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
|
||||
Dim Concec = AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
|
||||
drowPsTamaños("CveClacificacion").ToString.ToEntero, drowPsTamaños("Clacificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
|
||||
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
|
||||
drowPsTamaños("SubProyecto").ToString, EsCargo:=True)
|
||||
If Consec > 0 Then
|
||||
ListaPScargo.Add(drowPsTamaños("CvePS").ToString.ToEntero)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
ObjProductosServicios.Dispose()
|
||||
Modalidad = ModalidadBack
|
||||
End If
|
||||
ObjAcum.Dispose()
|
||||
|
||||
' End If
|
||||
End Sub
|
||||
Return ListaPScargo
|
||||
End Function
|
||||
Private Sub EliminarUsados(Consec As Integer)
|
||||
Dim DTTamanios As New DataTable
|
||||
|
||||
Dim ObjAcum As New ClsAcumuladores
|
||||
|
||||
If ObjAcum.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
DTTamanios = ObjAcum.DtResultados
|
||||
Dim DTCvePSCostos = ObjAcum.DtResultados.FiltraParametros("", "", {"CvePSCargo"})
|
||||
|
||||
If Not TmpDT.Columns.Contains("Eliminar") Then
|
||||
TmpDT.Columns.Add("Eliminar", GetType(Integer))
|
||||
End If
|
||||
|
||||
For Each drow As DataRow In TmpDT.FiltraParametros($"Consec ={Consec}").Rows
|
||||
For Each drow2 As DataRow In DTCvePSCostos.Rows
|
||||
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
|
||||
drow("Eliminar") = 1
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
Dim TmpDTView As New DataView(TmpDT)
|
||||
TmpDTView.RowFilter = "Eliminar = 1"
|
||||
|
||||
For Each dRowEliminar As DataRowView In TmpDTView
|
||||
For Each RowRecepcionUsados As DataRow In TmpDTRecepcionUsados.Rows
|
||||
If (RowRecepcionUsados("CvePS").ToString() = dRowEliminar("CvePS").ToString()) Then
|
||||
RowRecepcionUsados.Delete()
|
||||
End If
|
||||
Next
|
||||
dRowEliminar.Delete()
|
||||
Next
|
||||
|
||||
TmpDT.AcceptChanges()
|
||||
TmpDTRecepcionUsados.AcceptChanges()
|
||||
|
||||
End If
|
||||
ObjAcum.Dispose()
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
@@ -4099,6 +4099,13 @@ Partial Class Ventas
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Rem") And GvRemisiones.Rows.Count > 0 Then
|
||||
LbCancelarDocumento.Visible = False
|
||||
End If
|
||||
|
||||
'SI TIENE REMISIONES Y VA A CANCELAR ES NECESARIO EL MOVIMIENTO DE DEVOLUCION
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso GvRemisiones.Rows.Count > 0 Then
|
||||
ChkDevAlm.Checked = True
|
||||
ChkDevAlm.Enabled = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
tdVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
|
||||
@@ -9007,7 +9014,7 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
If ErrorList.Count = 0 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then
|
||||
If ErrorList.Count = 0 AndAlso factura.TipoDocto.Contiene("Ing", "Ant") Then
|
||||
'Agregamos las remisiones a la tabla
|
||||
If DtRemisionesPS IsNot Nothing AndAlso DtRemisionesPS.Rows.Count > 0 AndAlso ErrorList.Count = 0 Then
|
||||
Dim CveVentaDetalle As Integer = 0
|
||||
@@ -9030,7 +9037,7 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
If DTRemisiones IsNot Nothing AndAlso DTRemisiones.Rows.Count > 0 AndAlso ErrorList.Count = 0 Then
|
||||
If DTRemisiones IsNot Nothing AndAlso DTRemisiones.Rows.Count > 0 AndAlso ErrorList.Count = 0 AndAlso factura.TipoDocto.Contiene("Ing", "Ant") Then
|
||||
|
||||
Dim dt As DataTable = DTRemisiones.FiltraParametros("Aplicado = True")
|
||||
If dt.Rows.Count > 0 Then
|
||||
@@ -17766,6 +17773,7 @@ Partial Class Ventas
|
||||
Next
|
||||
End If
|
||||
|
||||
ObjFactura.CveAlmacenDevolucion = CveAlmacenDevolucion
|
||||
If ChkDevAlm.Checked Then
|
||||
ObjFactura.CveAlmacenDevolucion = CveAlmacenDevolucion
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user