Merge branch 'master' of http://rpimienta@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -4294,6 +4294,14 @@
|
||||
<asp:CompareValidator ID="CVFechaFUsados" runat="server" ControlToValidate="TxtFechaFUsados" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="ValidaUsados"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEFechaFUsados" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaFUsados" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
<label class="col-md-1 " style="width: 120px; text-align: right">Concepto:</label>
|
||||
<div class="col-md-2" style="width: 120px">
|
||||
<asp:DropDownList ID="DdlConceptoUsado" runat="server" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
|
||||
<asp:ListItem Text="Entradas" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Salidas" Value="2"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9137,7 +9137,7 @@ Partial Class Clientes
|
||||
Dim ImporteCargo As Decimal = 0D
|
||||
Dim ImporteBonificacion As Decimal = 0D
|
||||
|
||||
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, TxtFechaIUsados.Text.ToDate, TxtFechaFUsados.Text.ToDate) Then
|
||||
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, TxtFechaIUsados.Text.ToDate, TxtFechaFUsados.Text.ToDate, CveConcepto:=DdlConceptoUsado.SelectedValue.ToEntero()) Then
|
||||
|
||||
GvAcum.DataSource = ObjAcum.DtResultados
|
||||
|
||||
|
||||
@@ -1902,7 +1902,7 @@ Partial Class PV
|
||||
For Each Dr As DataRow In TmpDTAjustes.Rows
|
||||
If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero,
|
||||
Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero,
|
||||
Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime()) Then
|
||||
Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime(), Dr("PorcentajeAjuste").ToString.ToDecimal()) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar la garantia detalle.")
|
||||
End If
|
||||
Next
|
||||
|
||||
@@ -224,12 +224,13 @@
|
||||
|
||||
<div class="form-group form-md-line-input input-iconright" runat="server" id="DivPSSAT">
|
||||
<ADS:Dropdownlost runat="server" ID="DdlSATPS" CssStyle="width: 46%;" CssClass="form-control input-sm select2me" DataTextField="Descripcion" DataValueField="CveSATPS" />
|
||||
<%-- <asp:DropDownList ID="DdlSATPS" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="false" CausesValidation="true" DataTextField="Descripcion" DataValueField="CveSATPS" Width="350px" Enabled="true">
|
||||
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>--%>
|
||||
<label for="<%= DdlSATPS.ClientID.ToString()%>">Producto Servicio SAT:</label>
|
||||
<%-- <asp:RequiredFieldValidator ID="Rfvpssat" runat="server" ControlToValidate="DdlSATPS" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Productos Servicios SAT''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="vcepssat" runat="server" HighlightCssClass="vco" TargetControlID="Rfvpssat" Width="300px"></ajax:ValidatorCalloutExtender>--%>
|
||||
<i></i>
|
||||
</div>
|
||||
<br />
|
||||
<div class="form-group form-md-line-input input-iconright" runat="server" id="DivPSAdicionalVigencia" visible="false">
|
||||
<ADS:Dropdownlost runat="server" ID="DdlPSAdicionalVigencia" CssStyle="width: 46%;" CssClass="form-control input-sm select2me" DataTextField="PSCodigo" DataValueField="CvePS" />
|
||||
<label for="<%= DdlPSAdicionalVigencia.ClientID.ToString()%>">Producto de vigencia:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
@@ -212,6 +212,11 @@ Partial Class ProductosyServicios
|
||||
DdlIVA.Enabled = False
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
DivPSAdicionalVigencia.Visible = True
|
||||
CargaPSAdicionalesVigencias()
|
||||
End If
|
||||
|
||||
If CvePS > 0 Then
|
||||
CargaEquivalencias()
|
||||
CargaPSAdicionales()
|
||||
@@ -769,6 +774,12 @@ Partial Class ProductosyServicios
|
||||
DdlSATPS.SelectedText = $"{ObjProductosServicios.SATClavePS} - {ObjProductosServicios.SATDescripcion}"
|
||||
CveSATPS = ObjProductosServicios.CveSATPS
|
||||
End If
|
||||
|
||||
If ObjProductosServicios.DtResultados.Rows(0)("CvePSAdicionalVigencia").ToString.ToEntero() > 0 Then
|
||||
DdlPSAdicionalVigencia.SelectedValue = ObjProductosServicios.DtResultados.Rows(0)("CvePSAdicionalVigencia").ToString
|
||||
DdlPSAdicionalVigencia.SelectedText = ObjProductosServicios.DtResultados.Rows(0)("CodigoPSVigencia").ToString
|
||||
End If
|
||||
|
||||
If ObjProductosServicios.CveFraccionArancelaria.ToString <> Nothing Then
|
||||
DdlFraccionArancelaria.SelectedValue = ObjProductosServicios.CveFraccionArancelaria.ToString
|
||||
DdlFraccionArancelaria.SelectedText = ObjProductosServicios.ClaveSATFraccionArancelariaDescripcion
|
||||
@@ -918,6 +929,14 @@ Partial Class ProductosyServicios
|
||||
DdlSATPS.ddlWS.Attributes.Add("data-metodo", "getpssat")
|
||||
End Sub
|
||||
|
||||
Public Sub CargaPSAdicionalesVigencias()
|
||||
DdlPSAdicionalVigencia.setEsWebService(True)
|
||||
DdlPSAdicionalVigencia.Attributes.Add("data-cvesubproyecto", "-1")
|
||||
DdlPSAdicionalVigencia.ddlWS.Attributes.Add("data-cveclasificacion", "-1")
|
||||
DdlPSAdicionalVigencia.ddlWS.Attributes.Add("data-pagina", "ventas/ventas")
|
||||
DdlPSAdicionalVigencia.ddlWS.Attributes.Add("data-Estatus", "1")
|
||||
End Sub
|
||||
|
||||
Public Sub CargaDdlFraccionArancelaria()
|
||||
DdlFraccionArancelaria.setEsWebService(True)
|
||||
DdlFraccionArancelaria.Attributes.Add("data-metodo", "getfraccionarancelaria")
|
||||
@@ -1218,7 +1237,7 @@ Partial Class ProductosyServicios
|
||||
CveClasificacionDetalle:=DdlTipoPSDes.SelectedValue.ToEntero, CveTamaño:=DdlTamanio.SelectedValue.ToEntero,
|
||||
CveModelo:=DdlModelo.SelectedValue.ToEntero(), CveMedida:=DdlMedida.SelectedValue.ToEntero(), CveRinTamaño:=DdlRin.SelectedValue.ToEntero(),
|
||||
ClaveImpuestoEmpaque:=DdlImpEmpaque.SelectedValue.ToString, ClaveImpuestoUM:=DdlImpUM.SelectedValue.ToString, ClaveCategoriaToxicidad:=DdlCategoriaToxicidad.SelectedValue.ToString,
|
||||
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked, TiempoCaducidad:=TiempoCaducidad) > 0 Then
|
||||
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked, TiempoCaducidad:=TiempoCaducidad, CvePSAdicionalVigencia:=DdlPSAdicionalVigencia.SelectedValue.ToEntero()) > 0 Then
|
||||
ViewState("CvePS") = ObjProductosServicios.CvePS
|
||||
For Each GVR As GridViewRow In GvImpuestosLocales.Rows
|
||||
If GVR.FCCheckBox("ChkDeduccion").Checked Then
|
||||
@@ -1267,7 +1286,7 @@ Partial Class ProductosyServicios
|
||||
CveModelo:=DdlModelo.SelectedValue.ToEntero(), CveMedida:=DdlMedida.SelectedValue.ToEntero(), CveRinTamaño:=DdlRin.SelectedValue.ToEntero(),
|
||||
ClaveImpuestoEmpaque:=DdlImpEmpaque.SelectedValue.ToString, ClaveImpuestoUM:=DdlImpUM.SelectedValue.ToString, ClaveCategoriaToxicidad:=DdlCategoriaToxicidad.SelectedValue.ToString,
|
||||
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked,
|
||||
AplicaSerie:=ChkSerie.Checked, AplicaLote:=ChkLote.Checked, AplicaCaducidad:=ChkCaducidad.Checked, AplicaSeccion:=ChkSeccion.Checked, TiempoCaducidad:=TiempoCaducidad) Then
|
||||
AplicaSerie:=ChkSerie.Checked, AplicaLote:=ChkLote.Checked, AplicaCaducidad:=ChkCaducidad.Checked, AplicaSeccion:=ChkSeccion.Checked, TiempoCaducidad:=TiempoCaducidad, CvePSAdicionalVigencia:=DdlPSAdicionalVigencia.SelectedValue.ToEntero()) Then
|
||||
|
||||
If Not ObjProductosServicios.LimpiaImpuestosLocales(CvePS) Then
|
||||
TieneError = True
|
||||
|
||||
@@ -6152,7 +6152,7 @@
|
||||
<br />
|
||||
<div class="col-md-12" style="height: 440px; overflow: auto">
|
||||
<asp:GridView ID="GvCxC" runat="server" AutoGenerateColumns="False" OnRowDataBound="GvCxC_RowDataBound"
|
||||
DataKeyNames="CveVenta" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
|
||||
DataKeyNames="CveVenta,CveMetodoPago33,CveFormaPago33" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
@@ -6427,16 +6427,19 @@
|
||||
<h4 class="modal-title">Aplicar Devolución</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row" id="">
|
||||
<div class="row" id="DivPenalizacion" runat="server" visible="false">
|
||||
<div class="col-md-2">
|
||||
<label>Aplicar % de Penalización</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<asp:TextBox ID="TxtPorPenalizacion" runat="server" CssClass="form-control input-sm" Text="0" onkeyup="CalculaPenalizacionDevolucion(this);"></asp:TextBox>
|
||||
<div class="col-md-2">
|
||||
<asp:TextBox ID="TxtPorPenalizacion" runat="server" CssClass="form-control input-sm" Text="" onkeyup="LimitaPenalizacionDevolucion(this);"></asp:TextBox>
|
||||
<asp:RangeValidator ID="RFVPenalizacion" runat="server" Type="Integer" MinimumValue="0" MaximumValue="100" ErrorMessage="El campo <b>''Penalización''</b> es necesario, por favor ingréselo." ControlToValidate="TxtPorPenalizacion" Display="None"></asp:RangeValidator>
|
||||
<ajax:FilteredTextBoxExtender ID="FTBPenalizacion" runat="server" TargetControlID="TxtPorPenalizacion" FilterType="Custom, Numbers" ValidChars=".," />
|
||||
</div>
|
||||
<div class="col-md-6"></div>
|
||||
<div class="col-md-2">
|
||||
<asp:Button ID="BtnCalcularPenalizacion" runat="server" CssClass="btn btn-primary btn-sm" Text="Calcular" OnClick="BtnCalcularPenalizacion_Click" />
|
||||
</div>
|
||||
<div class="col-md-6"> </div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="text-right col-md-offset-8 col-md-4">
|
||||
@@ -6480,7 +6483,7 @@
|
||||
<asp:BoundField HeaderText="PU" DataField="PU" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:TemplateField HeaderText="PU Editado" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtPrecioEditado" runat="server" Text='<%#Eval("PU").ToString%>' MaxLength="12" Width="90%" Height="24px" CssClass="ImporteDevolucion"></asp:TextBox>
|
||||
<asp:TextBox ID="TxtPrecioEditado" runat="server" Text='<%#Eval("PU").ToString%>' MaxLength="12" Width="50%" Height="24px" CssClass="ImporteDevolucion"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender ID="SoloNumeros1Editado" runat="server" TargetControlID="TxtPrecioEditado" FilterType="Custom, Numbers" ValidChars=".," />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
@@ -7351,14 +7354,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
function CalculaPenalizacionDevolucion(TxtPenalizacion) {
|
||||
const Porcentaje = ToDouble(TxtPenalizacion.value) / ToDouble(100);
|
||||
if (Porcentaje <= 1) {
|
||||
$('.ImporteDevolucion').each(function () {
|
||||
const importe = ToDouble($(this).val());
|
||||
const resta = importe * Porcentaje;
|
||||
$(this).val(FormatoNumero((importe - resta), 2));
|
||||
});
|
||||
function LimitaPenalizacionDevolucion(TxtPenalizacion) {
|
||||
const Porcentaje = ToDouble(TxtPenalizacion.value)
|
||||
if (Porcentaje >= 100) {
|
||||
TxtPenalizacion.value = "100"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7931,7 +7930,6 @@
|
||||
}
|
||||
|
||||
function chkAnt(t, txt, importe, AmorContrato = 0) {
|
||||
debugger;
|
||||
var totalAnt = 0;
|
||||
|
||||
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
|
||||
|
||||
@@ -2053,6 +2053,10 @@ Partial Class Ventas
|
||||
thPoliza2.Visible = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso UsuarioActual.CveUsuario = 100 Then
|
||||
DivPenalizacion.Visible = True
|
||||
End If
|
||||
|
||||
|
||||
DdlSATPS.setEsWebService(True) : DdlSATPS.Attributes.Add("data-metodo", "getpssat")
|
||||
DivPSSAT.Visible = True
|
||||
@@ -23892,263 +23896,278 @@ Partial Class Ventas
|
||||
End Sub
|
||||
|
||||
Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False)
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
Else
|
||||
'VALIDA CLAVES SAT
|
||||
If DrPS("SATClavePS").ToString() = "" Then
|
||||
Alert($"El concepto <b>{DrPS("Codigo").ToString()}-{DrPS("PS").ToString()}</b> no cuenta con producto SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
|
||||
|
||||
Try
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
If DrPS Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
Else
|
||||
'VALIDA CLAVES SAT
|
||||
If DrPS("SATClavePS").ToString() = "" Then
|
||||
Alert($"El concepto <b>{DrPS("Codigo").ToString()}-{DrPS("PS").ToString()}</b> no cuenta con producto SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
If DrPS("SATClaveUnidadMedida").ToString() = "" Then
|
||||
Alert($"El concepto <b>{DrPS("Codigo").ToString()}-{DrPS("PS").ToString()}</b> no cuenta con Unidad Medida SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
If DrPS("SATClaveUnidadMedida").ToString() = "" Then
|
||||
Alert($"El concepto <b>{DrPS("Codigo").ToString()}-{DrPS("PS").ToString()}</b> no cuenta con Unidad Medida SAT. Por favor verifique y vuelva a intentar", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
|
||||
If Not AplicaImpuestosLocales Then
|
||||
If TmpDTImpuestos IsNot Nothing Then
|
||||
TmpDTImpuestos.Rows.Clear()
|
||||
GvImpuestosLocales2.DataSource = TmpDTImpuestos
|
||||
GvImpuestosLocales2.DataBind()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not AplicaImpuestosLocales Then
|
||||
If TmpDTImpuestos IsNot Nothing Then
|
||||
TmpDTImpuestos.Rows.Clear()
|
||||
GvImpuestosLocales2.DataSource = TmpDTImpuestos
|
||||
GvImpuestosLocales2.DataBind()
|
||||
End If
|
||||
End If
|
||||
Me.AplicoNCFacturaActual = AplicoNCFacturaActual
|
||||
|
||||
Me.AplicoNCFacturaActual = AplicoNCFacturaActual
|
||||
'CREAMOS DT PARA UTILIZAR AL TIMBRAR
|
||||
InicializaDTVentasNC()
|
||||
|
||||
'CREAMOS DT PARA UTILIZAR AL TIMBRAR
|
||||
InicializaDTVentasNC()
|
||||
Dim DtImpuestos As New DataTable
|
||||
DtImpuestos.Columns.Add("ImportePU", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("ImporteTotal", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("PorcentajeIVA", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("ImporteIVA", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("ImporteRetIVA", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("PorcentajeRetISR", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("ImporteRetISR", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("PorcentajeIEPS", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("ImporteIEPS", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||
DtImpuestos.AcceptChanges()
|
||||
Dim AcumuladoNC As Decimal = 0
|
||||
|
||||
Dim DtImpuestos As New DataTable
|
||||
DtImpuestos.Columns.Add("ImportePU", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("ImporteTotal", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("PorcentajeIVA", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("ImporteIVA", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("ImporteRetIVA", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("PorcentajeRetISR", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("ImporteRetISR", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("PorcentajeIEPS", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("ImporteIEPS", GetType(Decimal))
|
||||
DtImpuestos.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||
DtImpuestos.AcceptChanges()
|
||||
Dim AcumuladoNC As Decimal = 0
|
||||
Dim DtImpuestosBonificacion As DataTable = DtImpuestos.Copy()
|
||||
|
||||
Dim DtImpuestosBonificacion As DataTable = DtImpuestos.Copy()
|
||||
If Not AplicaNuevoDocumento Then
|
||||
If AplicaNCMasiva Then
|
||||
If NCDescuento Then
|
||||
For Each RNC In ListaNCDesc
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
|
||||
Next
|
||||
|
||||
If Not AplicaNuevoDocumento Then
|
||||
If AplicaNCMasiva Then
|
||||
If NCDescuento Then
|
||||
For Each RNC In ListaNCDesc
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
|
||||
Next
|
||||
|
||||
'SI HAY RNC DE BONIFICACION SE AGREGAN
|
||||
If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
|
||||
For Each RNC In ListaNCBonificacion
|
||||
DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
|
||||
'SI HAY RNC DE BONIFICACION SE AGREGAN
|
||||
If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
|
||||
For Each RNC In ListaNCBonificacion
|
||||
DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
Dim NumVentasAplicar As Integer = 1
|
||||
For Each Gvr As GridViewRow In GvCxC.Rows
|
||||
If Gvr.FCCheckBox("ChkCxC").Checked Then
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
|
||||
'CARGA FACTURA A LA CUAL SE APLICA LA NC
|
||||
AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal
|
||||
CargaNCDT(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal)
|
||||
If UsuarioActual.CveEmpresa = 140 AndAlso NumVentasAplicar = 1 Then
|
||||
DdlMetodoPago33.Enabled = True
|
||||
DdlMetodoPago33.SelectedValueExist(Gvr.DataKey("CveMetodoPago33").ToString())
|
||||
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
|
||||
DdlFormaPago33.Enabled = True
|
||||
DdlFormaPago33.SelectedValueExist(Gvr.DataKey("CveFormaPago33").ToString())
|
||||
End If
|
||||
NumVentasAplicar += 1
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero())
|
||||
|
||||
For Each Gvr As GridViewRow In GvCxC.Rows
|
||||
If Gvr.FCCheckBox("ChkCxC").Checked Then
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero()), True, MissingSchemaAction.Ignore)
|
||||
'CARGA FACTURA A LA CUAL SE APLICA LA NC
|
||||
AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal
|
||||
CargaNCDT(Gvr.DataKey("CveVenta").ToString().ToEntero(), Gvr.FCTextBox("TxtImporte").Text.ToString().ToDecimal)
|
||||
If EsNCAmortizacion Then
|
||||
If DtAnticipoAmortizacion Is Nothing Then
|
||||
InicializaDTAnticiposAmortizacion()
|
||||
End If
|
||||
Dim PorcentajeAplicado As Decimal = (TxtNCPorcentaje.Text.ToDecimal / 100D)
|
||||
|
||||
Dim RowAnticipo As DataRow = DtAnticipoAmortizacion.NewRow
|
||||
RowAnticipo("CveVenta") = Me.CveVenta
|
||||
RowAnticipo("Importe") = TxtNCImporte.Text.Trim.ToDecimal
|
||||
RowAnticipo("SaldoAnticipo") = SaldoAnticipo * PorcentajeAplicado
|
||||
|
||||
DtAnticipoAmortizacion.Rows.Add(RowAnticipo)
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
For Each RNC In ListaRemisionesNC
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
|
||||
Next
|
||||
For Each RNC In ListaNCBonificacion
|
||||
DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
Dim query = From dr In DtImpuestos
|
||||
Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal,
|
||||
PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
|
||||
PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
|
||||
PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
|
||||
Into x = Group
|
||||
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
|
||||
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
|
||||
ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
|
||||
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
|
||||
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
|
||||
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
|
||||
PorcentajeIVA = PorcentajeIVA,
|
||||
PorcentajeRetIVA = PorcentajeRetIVA,
|
||||
PorcentajeRetISR = PorcentajeRetISR,
|
||||
PorcentajeIEPS = PorcentajeIEPS
|
||||
|
||||
|
||||
Dim queryBonificacion = From dr In DtImpuestosBonificacion
|
||||
Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal,
|
||||
PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
|
||||
PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
|
||||
PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
|
||||
Into x = Group
|
||||
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
|
||||
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
|
||||
ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
|
||||
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
|
||||
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
|
||||
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
|
||||
PorcentajeIVA = PorcentajeIVA,
|
||||
PorcentajeRetIVA = PorcentajeRetIVA,
|
||||
PorcentajeRetISR = PorcentajeRetISR,
|
||||
PorcentajeIEPS = PorcentajeIEPS
|
||||
|
||||
|
||||
Dim DrSubProyecto = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("")
|
||||
|
||||
If DrSubProyecto Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información de centro de costos. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
DtImpuestos = query.QueryToDataTable(False)
|
||||
DtImpuestosBonificacion = queryBonificacion.QueryToDataTable(False)
|
||||
|
||||
If Not NCDescuento Then
|
||||
LimpiaDocumentoNC()
|
||||
End If
|
||||
|
||||
Dim CveSubProyecto = DrSubProyecto("CveSubProyecto").ToString().ToEntero()
|
||||
Dim SubProyecto = DrSubProyecto("SubProyecto").ToString()
|
||||
Dim CveProyecto = DrSubProyecto("CveProyecto").ToString().ToEntero()
|
||||
Dim Proyecto = DrSubProyecto("Proyecto").ToString()
|
||||
|
||||
AplicaNC = True
|
||||
|
||||
If NCDescuento Then
|
||||
TmpDTDescNC = TmpDT.Clone()
|
||||
TmpDTDescNC.Clear()
|
||||
|
||||
If UsuarioActual.CveEmpresa = 140 Then
|
||||
|
||||
CrearDTNCCargo(ListaNCDesc, DtImpuestos, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
|
||||
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
|
||||
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
|
||||
If DrPSBonificacion IsNot Nothing Then
|
||||
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
Else
|
||||
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
|
||||
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
End If
|
||||
|
||||
Else
|
||||
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
|
||||
End If
|
||||
Else
|
||||
DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero())
|
||||
|
||||
If EsNCAmortizacion Then
|
||||
If DtAnticipoAmortizacion Is Nothing Then
|
||||
InicializaDTAnticiposAmortizacion()
|
||||
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")
|
||||
'verifica el total de multiples facturas
|
||||
Dim Acumulado12 As Decimal = 0
|
||||
Dim UltimoRenglon As Integer = 1
|
||||
Dim Ajuste As Decimal = 0
|
||||
|
||||
'DEBE AGREGAR LOS USADOS DE LA REMISION EN LA NOTA DE CREDITO
|
||||
If UsuarioActual.CveEmpresa = 140 AndAlso (ListaRemisionesNC IsNot Nothing AndAlso ListaRemisionesNC.Count > 0) Then
|
||||
|
||||
CrearDTNCCargo(ListaRemisionesNC, DtImpuestos, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
|
||||
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
|
||||
If DrPSBonificacion IsNot Nothing Then
|
||||
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
Else
|
||||
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
|
||||
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
End If
|
||||
Dim PorcentajeAplicado As Decimal = (TxtNCPorcentaje.Text.ToDecimal / 100D)
|
||||
|
||||
Dim RowAnticipo As DataRow = DtAnticipoAmortizacion.NewRow
|
||||
RowAnticipo("CveVenta") = Me.CveVenta
|
||||
RowAnticipo("Importe") = TxtNCImporte.Text.Trim.ToDecimal
|
||||
RowAnticipo("SaldoAnticipo") = SaldoAnticipo * PorcentajeAplicado
|
||||
|
||||
DtAnticipoAmortizacion.Rows.Add(RowAnticipo)
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
For Each RNC In ListaRemisionesNC
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
|
||||
Next
|
||||
For Each RNC In ListaNCBonificacion
|
||||
DtImpuestosBonificacion.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales, NivelTotal:=DdlNCNivelImporte.SelectedValue.ToEntero(), AplicaNCUsado:=(UsuarioActual.CveEmpresa = 140)), True, MissingSchemaAction.Ignore)
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
Dim query = From dr In DtImpuestos
|
||||
Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal,
|
||||
PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
|
||||
PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
|
||||
PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
|
||||
Into x = Group
|
||||
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
|
||||
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
|
||||
ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
|
||||
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
|
||||
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
|
||||
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
|
||||
PorcentajeIVA = PorcentajeIVA,
|
||||
PorcentajeRetIVA = PorcentajeRetIVA,
|
||||
PorcentajeRetISR = PorcentajeRetISR,
|
||||
PorcentajeIEPS = PorcentajeIEPS
|
||||
|
||||
|
||||
Dim queryBonificacion = From dr In DtImpuestosBonificacion
|
||||
Group By PorcentajeIVA = dr("PorcentajeIVA").ToString().ToDecimal,
|
||||
PorcentajeRetIVA = dr("PorcentajeRetIVA").ToString().ToDecimal,
|
||||
PorcentajeRetISR = dr("PorcentajeRetISR").ToString().ToDecimal,
|
||||
PorcentajeIEPS = dr("PorcentajeIEPS").ToString().ToDecimal
|
||||
Into x = Group
|
||||
Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString().ToDecimal),
|
||||
ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString().ToDecimal),
|
||||
ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString().ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString().ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA,
|
||||
ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetIVA,
|
||||
ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString().ToDecimal, 2)),' Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeRetISR,
|
||||
ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString().ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString().ToDecimal, 2)) * PorcentajeIEPS,
|
||||
PorcentajeIVA = PorcentajeIVA,
|
||||
PorcentajeRetIVA = PorcentajeRetIVA,
|
||||
PorcentajeRetISR = PorcentajeRetISR,
|
||||
PorcentajeIEPS = PorcentajeIEPS
|
||||
|
||||
|
||||
Dim DrSubProyecto = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, -1).FiltroPrimero("")
|
||||
|
||||
If DrSubProyecto Is Nothing Then
|
||||
Alert("Ocurrió un error al cargar la información de centro de costos. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
DtImpuestos = query.QueryToDataTable(False)
|
||||
DtImpuestosBonificacion = queryBonificacion.QueryToDataTable(False)
|
||||
|
||||
If Not NCDescuento Then
|
||||
LimpiaDocumentoNC()
|
||||
End If
|
||||
|
||||
Dim CveSubProyecto = DrSubProyecto("CveSubProyecto").ToString().ToEntero()
|
||||
Dim SubProyecto = DrSubProyecto("SubProyecto").ToString()
|
||||
Dim CveProyecto = DrSubProyecto("CveProyecto").ToString().ToEntero()
|
||||
Dim Proyecto = DrSubProyecto("Proyecto").ToString()
|
||||
|
||||
AplicaNC = True
|
||||
|
||||
If NCDescuento Then
|
||||
TmpDTDescNC = TmpDT.Clone()
|
||||
TmpDTDescNC.Clear()
|
||||
|
||||
If UsuarioActual.CveEmpresa = 140 Then
|
||||
|
||||
CrearDTNCCargo(ListaNCDesc, DtImpuestos, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
|
||||
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
|
||||
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
|
||||
If DrPSBonificacion IsNot Nothing Then
|
||||
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
Else
|
||||
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
|
||||
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
End If
|
||||
|
||||
Else
|
||||
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
|
||||
End If
|
||||
|
||||
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")
|
||||
'verifica el total de multiples facturas
|
||||
Dim Acumulado12 As Decimal = 0
|
||||
Dim UltimoRenglon As Integer = 1
|
||||
Dim Ajuste As Decimal = 0
|
||||
|
||||
'DEBE AGREGAR LOS USADOS DE LA REMISION EN LA NOTA DE CREDITO
|
||||
If UsuarioActual.CveEmpresa = 140 AndAlso ListaRemisionesNC.Count > 0 Then
|
||||
|
||||
CrearDTNCCargo(ListaRemisionesNC, DtImpuestos, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
|
||||
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
|
||||
If DrPSBonificacion IsNot Nothing Then
|
||||
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
Else
|
||||
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
|
||||
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
End If
|
||||
|
||||
Else
|
||||
For Each Dr As DataRow In DtImpuestos.Rows
|
||||
Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal
|
||||
If UltimoRenglon = DtImpuestos.Rows.Count Then
|
||||
'ajusta 5 centavos de diferencia
|
||||
If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then
|
||||
Ajuste = (Acumulado12 - AcumuladoNC)
|
||||
For Each Dr As DataRow In DtImpuestos.Rows
|
||||
Acumulado12 += Dr("ImportePU").ToString().ToDecimal.RoundSQL + Dr("ImporteIVA").ToString().ToDecimal.RoundSQL + Dr("ImporteIEPS").ToString().ToDecimal
|
||||
If UltimoRenglon = DtImpuestos.Rows.Count Then
|
||||
'ajusta 5 centavos de diferencia
|
||||
If Acumulado12 <> AcumuladoNC And Math.Abs(Acumulado12 - AcumuladoNC) <= 0.05 Then
|
||||
Ajuste = (Acumulado12 - AcumuladoNC)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
UltimoRenglon += 1
|
||||
UltimoRenglon += 1
|
||||
|
||||
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 + Ajuste, 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)
|
||||
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 + Ajuste, 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
|
||||
End If
|
||||
|
||||
|
||||
GvPS.DataSource = TmpDT
|
||||
GvPS.DataBind()
|
||||
|
||||
CalculaTotalesVenta(RecalculaImpuestosLocales:=AplicaImpuestosLocales)
|
||||
|
||||
TrTipoRelacion.Visible = True
|
||||
DdlTiposRelacion.SelectedValueExist("1")
|
||||
DdlSubProyectoDatos.Enabled = False
|
||||
|
||||
'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00
|
||||
If Not AplicaNCMasiva Then
|
||||
Dim TT As Decimal = TxtNCImporte.Text.ToDecimal
|
||||
If TT > TxtTotal.Text.ToDecimal Then TT = TxtTotal.Text.ToDecimal
|
||||
CargaNCDT(CveVenta, TT)
|
||||
End If
|
||||
'verifica el tipo de cambio que se actualice
|
||||
If DdlMoneda.SelectedValue <> "1" Then
|
||||
TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString()
|
||||
End If
|
||||
LblTCValuacion.Visible = False
|
||||
UpPS.Update()
|
||||
|
||||
LBNotaCredito.Visible = False
|
||||
CambiaTipoDocto()
|
||||
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
GvPS.DataSource = TmpDT
|
||||
GvPS.DataBind()
|
||||
|
||||
CalculaTotalesVenta(RecalculaImpuestosLocales:=AplicaImpuestosLocales)
|
||||
|
||||
TrTipoRelacion.Visible = True
|
||||
DdlTiposRelacion.SelectedValueExist("1")
|
||||
DdlSubProyectoDatos.Enabled = False
|
||||
|
||||
'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00
|
||||
If Not AplicaNCMasiva Then
|
||||
Dim TT As Decimal = TxtNCImporte.Text.ToDecimal
|
||||
If TT > TxtTotal.Text.ToDecimal Then TT = TxtTotal.Text.ToDecimal
|
||||
CargaNCDT(CveVenta, TT)
|
||||
End If
|
||||
'verifica el tipo de cambio que se actualice
|
||||
If DdlMoneda.SelectedValue <> "1" Then
|
||||
TxtTipoCambio.Text = GlobalTipoCambio(Now).ToString()
|
||||
End If
|
||||
LblTCValuacion.Visible = False
|
||||
UpPS.Update()
|
||||
|
||||
LBNotaCredito.Visible = False
|
||||
CambiaTipoDocto()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al aplicar NC", ex)
|
||||
End Try
|
||||
UPCondicionesPago.Update()
|
||||
|
||||
End Sub
|
||||
Private Sub CrearDTNCCargo(ListaNC As List(Of Modelos.Factura), DtImpuestos As DataTable, ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
|
||||
@@ -24467,11 +24486,13 @@ Partial Class Ventas
|
||||
'ACTIVA CONDICIONES DE PAGO
|
||||
DdlUsoCFDI.Enabled = True
|
||||
DdlUsoCFDI.SelectedValueExist("2")
|
||||
DdlMetodoPago33.Enabled = True
|
||||
DdlMetodoPago33.SelectedValueExist("1") ' PUE
|
||||
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
|
||||
DdlFormaPago33.Enabled = True
|
||||
DdlFormaPago33.SelectedValueExist("11") ' condonación por default
|
||||
If UsuarioActual.CveEmpresa <> 140 Then
|
||||
DdlMetodoPago33.Enabled = True
|
||||
DdlMetodoPago33.SelectedValueExist("1") ' PUE
|
||||
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
|
||||
DdlFormaPago33.Enabled = True
|
||||
DdlFormaPago33.SelectedValueExist("11") ' condonación por default
|
||||
End If
|
||||
|
||||
UpEstatus.Update()
|
||||
UpnTools.Update()
|
||||
@@ -24595,6 +24616,22 @@ Partial Class Ventas
|
||||
UpDevolucion.Update()
|
||||
|
||||
End Sub
|
||||
Protected Sub BtnCalcularPenalizacion_Click(sender As Object, e As EventArgs)
|
||||
Dim PorcentajePenalizacion As Decimal = (TxtPorPenalizacion.Text.ToDecimal() / 100D)
|
||||
|
||||
For Each GvRow As GridViewRow In GvAplicaDevolucion.Rows
|
||||
If GvRow.FCCheckBox("Chk").Checked Then
|
||||
|
||||
Dim Total As Decimal = GvRow.DataKey("PU").ToDecimal() - (GvRow.DataKey("Descuento").ToDecimal() / GvRow.DataKey("Cantidad").ToDecimal())
|
||||
|
||||
'APLICA EL PORCENTAJE DE PENALIZACION
|
||||
GvRow.FCTextBox("TxtPrecioEditado").Text = (Total - (Total * PorcentajePenalizacion)).FormatoNumero(2)
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
UpDevolucion.Update()
|
||||
End Sub
|
||||
Protected Sub BtnAplicaDevolucion_Click(sender As Object, e As EventArgs)
|
||||
|
||||
'VALIDACIONES
|
||||
@@ -27229,6 +27266,33 @@ Partial Class Ventas
|
||||
End If
|
||||
Next
|
||||
|
||||
'SI TIENE ALGUN AJUSTE O GARANTIA
|
||||
If ListaRemisionesNC.Any(Function(RNC) RNC.Num2 = 1) Then
|
||||
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
|
||||
Dim Salir As Boolean = False
|
||||
Using ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then
|
||||
'SI ES GARANTIA TOTAL
|
||||
If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then
|
||||
DdlNCPS.SelectedValueExist(443174)
|
||||
DdlNCPS.Enabled = False
|
||||
Salir = True
|
||||
Else
|
||||
DdlNCPS.SelectedValueExist(443173)
|
||||
DdlNCPS.Enabled = False
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
If Salir Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
DdlNCPS.Enabled = True
|
||||
End If
|
||||
|
||||
|
||||
For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
||||
@@ -27304,6 +27368,28 @@ Partial Class Ventas
|
||||
End If
|
||||
Next
|
||||
|
||||
'SI TIENE ALGUN AJUSTE O GARANTIA
|
||||
If ListaNCDesc.Any(Function(RNC) RNC.Num2 = 1) Then
|
||||
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
|
||||
Dim Salir As Boolean = False
|
||||
Using ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then
|
||||
'SI ES GARANTIA TOTAL
|
||||
If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=443174, AplicaParaVenta:=1).Rows(0)
|
||||
Salir = True
|
||||
Else
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=443173, AplicaParaVenta:=1).Rows(0)
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
If Salir Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Dim LimiteUsados As Decimal = LblSaldoMaximoUsados.Text.Trim().ToDecimal()
|
||||
|
||||
'VERIFICA EL LIMITE DE LOS USADOS
|
||||
|
||||
Reference in New Issue
Block a user