This commit is contained in:
Oscar Irigoyen
2023-05-11 09:31:12 -07:00
41 changed files with 2628 additions and 2697 deletions

View File

@@ -644,7 +644,7 @@
 
<asp:DropDownList ID="DdlTipoDeduccion" runat="server" Width="300px">
<asp:ListItem Text="Gasto No Deducible" Value="255" Selected="True"></asp:ListItem>
<asp:ListItem Text="Incobrable No Deducible" Value="211"></asp:ListItem>
<asp:ListItem Text="Incobrable No Deducible" Value="179"></asp:ListItem>
<asp:ListItem Text="Incobrable Deducible" Value="263"></asp:ListItem>
<asp:ListItem Text="Reservas" Value="252"></asp:ListItem>
<asp:ListItem Text="Otros Ingresos" Value="78"></asp:ListItem>

View File

@@ -2443,7 +2443,7 @@ Partial Class Ventas_ClientesAbonar
Dim ConceptoPartida As String = TxtObsSaldarIncobrable.Text.Trim & " " & gr.DataKey("SerieFolio").ToString
If CveConceptoDeduccion = 255 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(266).ToEntero
If CveConceptoDeduccion = 211 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(559).ToEntero
If CveConceptoDeduccion = 179 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(559).ToEntero
If CveConceptoDeduccion = 263 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(537).ToEntero
If CveConceptoDeduccion = 252 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.Funcionalidad(581).ToEntero
If CveConceptoDeduccion = 78 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.IdCuentaOtrosIngresos
@@ -2476,22 +2476,18 @@ Partial Class Ventas_ClientesAbonar
Else
IdCtaContable = IdCuentaCliente
End If
Dim ConPreP As ConceptosTipoSaldo = ClsPaginas.ObtenerCveConceptoPrePoliza(6, tCveMoneda, True, 1)
'normal
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, ConPreP.CveConcepto, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
If UsaComplementaria AndAlso tCveMoneda = 2 Then
'normal
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
'complementaria
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, 0, gr.DataKey("SerieFolio").ToString, 207, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContComplementaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, (Saldo * TCVenta) - Saldo).RoundSQL, ImporteME:=Saldo, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, 0, gr.DataKey("SerieFolio").ToString, ConPreP.CveConceptoComplementario, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContComplementaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, (Saldo * TCVenta) - Saldo).RoundSQL, ImporteME:=Saldo, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
Else
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo * TCVenta), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
End If
'fluctuación.
@@ -2519,27 +2515,15 @@ Partial Class Ventas_ClientesAbonar
End If
' iva
Dim PorcentajeImpuesto As Decimal = gr.DataKey("PorcentajeIVA").ToDecimal
Dim IdCtaIVAXTrasladar As Integer = 0
Dim CveCuentaIVAxTrasladar As Integer = 0
'If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
' IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXTrasladar").ToString.ToEntero
' CveCuentaIVAxTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVAxTrasladar").ToString.ToEntero
'End If
If (IVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And IVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, gr.DataKey("SerieFolio").ToString, 13, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IVA, IVA * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If (IVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And IVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, gr.DataKey("SerieFolio").ToString, 13, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IVA, IVA * TCVenta), PorcentajeImpuesto:=gr.DataKey("PorcetajeIVA").ToDecimal, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
If (RETIVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And RETIVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, RETIVA, gr.DataKey("SerieFolio").ToString, 8, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContRetIVA, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, RETIVA, RETIVA * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If (RETIVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And RETIVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, RETIVA, gr.DataKey("SerieFolio").ToString, 8, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContRetIVA, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, RETIVA, RETIVA * TCVenta), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If
If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IEPS, gr.DataKey("SerieFolio").ToString, 38, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IEPS, IEPS * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IEPS, gr.DataKey("SerieFolio").ToString, 38, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IEPS, IEPS * TCVenta), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then
MsgError = "Ocurrio un error al saldar el movimiento"
End If

View File

@@ -152,7 +152,7 @@
<asp:GridView ID="GvDatos" runat="server" OnRowDataBound="GvDatos_RowDataBound" GridLines="None"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" AutoGenerateColumns="False"
EmptyDataText="No se encontraron registros" data-sort="true" Width="99%"
DataKeyNames="CveCliente,CveMoneda,Saldo,Folio,CveVenta,NombreComercial,CveVentaAmortizacion,SerieFolioAmortizacion,SerieFolio,Total,
DataKeyNames="CveCliente,CveMoneda,Saldo,CveVenta,NombreComercial,CveVentaAmortizacion,SerieFolioAmortizacion,SerieFolio,Total,TipoCambio,
Fecha,FechaAmortizacion,SubTotal,SubTotalAmortizacion,ImporteAmortizacion,CveIE,Tipo,SaldoAcumulativo,CveSubProyecto">
<Columns>
<asp:TemplateField>

View File

@@ -1,4 +1,5 @@
using System;
using System.Activities.Expressions;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@@ -324,80 +325,103 @@ public partial class Ventas_RepAnticipo_NC_IXCDetalle : ClsPaginas
{
ClsContabilidad ObjConta = new ClsContabilidad();
ObjConta.IniciaTransacSQL();
int CvePrePoliza = 0, ConceptoContable1 = 0, ConceptoContable2 = 0, CveVenta = -1, CveIE = -1;
int CvePrePoliza = 0, CveVenta = -1, CveIE = -1;
decimal Saldo = 0;
string MsgError = "";
if (Tipo == 2)
{
ConceptoContable1 = 91;
ConceptoContable2 = 12;
}
else if (Tipo == 1)
{
ConceptoContable1 = 11;
ConceptoContable2 = 3;
}
else if (Tipo == 3)
{
ConceptoContable1 = 92;
ConceptoContable2 = 92;
}
decimal ImporteTotalGasto = 0;
string MsgError = "";
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/RepNCXAplicar", 6, 0, 0, 1, TxtFecha.Text.ToDate(), TxtConcepto.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
foreach (GridViewRow Gv in GvDatos.Rows)
{
if (Gv.FCCheckBox("Chk").Checked)
if (CvePrePoliza > 0)
{
foreach (GridViewRow Gv in GvDatos.Rows)
{
if (Tipo == 1 || Tipo == 2)
{
CveVenta = Gv.DataKey("CveVenta").ToEntero();
Saldo = -Gv.DataKey("Saldo").ToDecimal();
}
else if (Tipo == 3)
{
CveIE = Gv.DataKey("CveIE").ToEntero();
Saldo = Gv.DataKey("Saldo").ToDecimal();
}
int IdCtaContable = 0;
if (ObjConta.GetRetCuenta(ConceptoContable1, Gv.DataKey("CveCliente").ToEntero()))
{
if (ObjConta.DtResultados.Rows.Count > 0)
ConceptosTipoSaldo ConPreP = new ConceptosTipoSaldo();
if (Gv.FCCheckBox("Chk").Checked)
{
if (Tipo == 2)
{
ConPreP = ClsPaginas.get_ObtenerCveConceptoPrePoliza(6, Gv.DataKey("CveMoneda").ToEntero(), false, 2);
}
else if (Tipo == 1)
{
ConPreP.CveConcepto = 3;
}
if (Tipo == 1 || Tipo == 2)
{
if (Tipo == 1 || Tipo == 2)
{
IdCtaContable = ObjConta.DtResultados.Rows[0]["IdCtaContable"].ToString().ToEntero();
}
else if (Tipo == 3)
{
IdCtaContable = ObjConta.DtResultados.Rows[0]["IdCtaContClientes"].ToString().ToEntero();
CveVenta = Gv.DataKey("CveVenta").ToEntero();
Saldo = -Gv.DataKey("Saldo").ToDecimal();
}
else if (Tipo == 3)
{
ConPreP.CveConcepto = 92;
CveIE = Gv.DataKey("CveIE").ToEntero();
Saldo = Gv.DataKey("Saldo").ToDecimal();
}
int IdCtaContable = 0;
if (UsuarioActual.Empresa.TipoContabilidad == 2)
{
if (UsuarioActual.Empresa.TipoContabilidad == 2 && ObjConta.GetRetCuenta(ConPreP.CveConcepto, Gv.DataKey("CveCliente").ToEntero()))
{
if (ObjConta.DtResultados.Rows.Count > 0)
{
if (Tipo == 1 || Tipo == 2)
{
IdCtaContable = ObjConta.DtResultados.Rows[0]["IdCtaContable"].ToString().ToEntero();
}
else if (Tipo == 3)
{
IdCtaContable = ObjConta.DtResultados.Rows[0]["IdCtaContClientes"].ToString().ToEntero();
}
}
}
else
{
break;
}
}
ImporteTotalGasto += Saldo;
if (!ObjConta.AddPrePolizasDetalle(CvePrePoliza, true, Saldo, Gv.DataKey("SerieFolio").ToString(), ConPreP.CveConcepto, TxtConcepto.Text, TxtFecha.Text.ToDate(), IdCtaContable, -1, CveIE, CveVenta, CveCliente: Gv.DataKey("CveCliente").ToEntero(), ImporteMX: Saldo))
{
MsgError = "Ocurrio un error al saldar el movimiento";
break;
}
if (Gv.DataKey("CveMoneda").ToEntero() > 1 )
{
decimal ImporteMN = (Saldo * Gv.DataKey("TipoCambio").ToDecimal() - Saldo).RoundSQL();
ImporteTotalGasto += ImporteMN;
if (!ObjConta.AddPrePolizasDetalle(CvePrePoliza, true, Saldo, Gv.DataKey("SerieFolio").ToString(), ConPreP.CveConceptoComplementario, TxtConcepto.Text, TxtFecha.Text.ToDate(), IdCtaContable, -1, CveIE, CveVenta, CveCliente: Gv.DataKey("CveCliente").ToEntero(), ImporteME: Saldo, ImporteMX: ImporteMN, TipoCambio: Gv.DataKey("TipoCambio").ToDecimal()))
{
MsgError = "Ocurrio un error al saldar el movimiento";
break;
}
}
}
else
}
}
if (ImporteTotalGasto != 0)
{
ImporteTotalGasto = ImporteTotalGasto * -1; // se invierte el valor, para cuadre de prepoliza
if (!ObjConta.AddPrePolizasDetalle(CvePrePoliza, true, ImporteTotalGasto, "", 78, TxtConcepto.Text, TxtFecha.Text.ToDate(), UsuarioActual.Empresa.IdCuentaOtrosIngresos, -1, CveIE, CveVenta, ImporteMX: ImporteTotalGasto, CveSubProyecto: DdlSubProyectoSaldar.SelectedValue.ToEntero()))
{
break;
}
CvePrePoliza = ObjConta.AddPrePolizas("Bancos/RepNCXAplicar", 6, Gv.DataKey("Saldo").ToDouble(), Gv.DataKey("Saldo").ToDouble(), Gv.DataKey("CveMoneda").ToEntero(), TxtFecha.Text.ToDate(), "Saldo de NC por Sistema", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
if (!ObjConta.AddPrePolizasDetalle(CvePrePoliza, true, Saldo, Gv.DataKey("Folio").ToString(), ConceptoContable2, TxtConcepto.Text, TxtFecha.Text.ToDate(), IdCtaContable, -1, CveIE, CveVenta, CveCliente: Gv.DataKey("CveCliente").ToEntero(), ImporteMX: Saldo))
{
MsgError = "Ocurrio un error al saldar el movimiento";
break;
}
if (!ObjConta.AddPrePolizasDetalle(CvePrePoliza, true, Gv.DataKey("Saldo").ToDecimal(), Gv.DataKey("Folio").ToString(), 78, TxtConcepto.Text, TxtFecha.Text.ToDate(), UsuarioActual.Empresa.IdCuentaOtrosIngresos, -1, CveIE, CveVenta, ImporteMX: Gv.DataKey("Saldo").ToDecimal(), CveSubProyecto: DdlSubProyectoSaldar.SelectedValue.ToEntero()))
{
MsgError = "Ocurrio un error al saldar el movimiento";
break;
}
}
else
{
MsgError = "Poliza no insertada";
}
}
if (MsgError == "")
{
ObjConta.Commit();
Alert("Los movimientos se saldaron correctamente.");
string Msg = "Los movimientos se saldaron correctamente.";
Msg = Msg + $"<br/><br/><a Class='Texto' target='_blank' href='/Contabilidad/RegPrePolizaS.aspx?CvePrePoliza={CvePrePoliza}'>Ver Póliza</a>&nbsp;&nbsp; ";
Alert(Msg);
}
else
{

View File

@@ -1066,12 +1066,21 @@
</asp:UpdatePanel>
</th>
<th>
<asp:TextBox ID="TxtPrecio" runat="server" onkeypress="setFocus(event,'LbAgregar');" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GprAgregaPS" Width="76px" Height="24px" CssClass="form-control input-sm "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgregaPS"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVPrecio" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GprAgregaPS"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecio" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<div class="row" id="DivPrecioLista" runat="server" visible="false">
<div class="col-md-12">
<asp:DropDownList ID="DdlPrecioLista" runat="server" Width="100%" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista" OnSelectedIndexChanged="DdlPrecioLista_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:TextBox ID="TxtPrecio" runat="server" onkeypress="setFocus(event,'LbAgregar');" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GprAgregaPS" Width="100%" Height="24px" CssClass="form-control input-sm "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgregaPS"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVPrecio" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GprAgregaPS"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecio" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</th>
<th id="thEncDesc2" runat="server" visible="true"></th>
<th id="thPredial2" runat="server" visible="false">
@@ -1207,7 +1216,16 @@
<%--9--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU", "{0:N2}") %>'></asp:Literal>
<div class="row">
<div class="col-md-12">
<asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU", "{0:N2}") %>'></asp:Literal>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:Literal ID="LtlPrecioLista" runat="server" Visible="false" Text='<%# Eval("PrecioLista") %>'></asp:Literal>
</div>
</div>
</ItemTemplate>
<EditItemTemplate>
<asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU") %>' Visible="false"></asp:Literal>

View File

@@ -2450,7 +2450,7 @@ Partial Class Ventas
UpFacturar.Update()
'CargaTiposDocumentos()
TrEmitir.Visible = False
If UsuarioActual.CveRol = 1 OrElse UsuarioActual.CveEmpresa.Contiene(13, 83, 172, 173) Then
If UsuarioActual.Empresa.Funcionalidad(161) = "1" Then
DivCartaPorte.Visible = True
End If
ViewState("EstablecioFolio") = False
@@ -2734,6 +2734,9 @@ Partial Class Ventas
TmpDT.Columns.Add("TieneProntoPago", GetType(String))
TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
TmpDT.Columns.Add("CveMarca", GetType(Integer))
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
TmpDT.Columns.Add("PrecioLista", GetType(String))
GvPS.DataSource = ObjVentas.DtResultados
GvPS.DataBind()
@@ -2758,6 +2761,9 @@ Partial Class Ventas
TmpDT.Columns.Add("TieneProntoPago", GetType(String))
TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
TmpDT.Columns.Add("CveMarca", GetType(Integer))
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
TmpDT.Columns.Add("PrecioLista", GetType(String))
GvPS.DataSource = ObjVentas.DtResultados
GvPS.DataBind()
@@ -3125,6 +3131,11 @@ Partial Class Ventas
If Not ExFolioFactura Then SetPermisos()
If CveVenta < 1 Then CargaFolios()
If CveVenta <= 0 AndAlso UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
CargaListasPrecios()
End If
'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE
'If UsuarioActual.CveVendedor > 0 Then
' If CveVenta = -1 AndAlso Not DdlVendedor.SelectedValue.ToEntero() > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString())
@@ -3475,6 +3486,21 @@ Partial Class Ventas
End If
End Sub
Private Sub CargaListasPrecios()
DivPrecioLista.Visible = True
Using ObjVta As New ClsVentas
If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then
DdlPrecioLista.DataSource = ObjVta.DtResultados.Copy()
End If
End Using
DdlPrecioLista.DataBind()
DdlPrecioLista.Items.Insert(0, New ListItem("Seleccione", "-1"))
UpPS.Update()
End Sub
Private Sub BloqueaClasificaciones()
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
DdlClasificacion.Enabled = False
@@ -6076,12 +6102,6 @@ Partial Class Ventas
End Sub
Private Sub CargaFormaPago(CveMetodoPago As Integer)
'EN LA VERSION 4.0 NO PERMITE DESBLOEQUEAR RELACION METODO Y FOMA DE PAGO
'If UsuarioActual.Empresa.Funcionalidad(350) <> "1" Then
' 'permiso para desbloquear la relación entre Método de pago y forma de pago
' If UsuarioActual.TienePermisoProceso(282) Then CveMetodoPago = -1
'End If
Dim dtt As DataTable = Nothing
If CveMetodoPago > 0 Then
dtt = GlobalDTVtaFormaPago.FiltraParametros(If(CveMetodoPago = 1, " CveFormaPago <> 20 ", "CveFormaPago = 20"))
@@ -6117,22 +6137,13 @@ Partial Class Ventas
'End If
End Sub
Private Sub CargaUsoCFDI()
If UsuarioActual.Empresa.Funcionalidad(350) <> "1" Then
RegimenFiscalCliente = "-1"
End If
DdlUsoCFDI.Items.Clear()
DdlSucursalUsoCFDI.Items.Clear()
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
Dim EsPersonaMoral As Boolean = (TipoPersona = True)
Dim EsPersonaMoral As Boolean = (TipoPersona = True)
DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
Else
DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente)
DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente)
End If
DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
DdlUsoCFDI.DataBind()
DdlSucursalUsoCFDI.DataBind()
@@ -6463,12 +6474,10 @@ Partial Class Ventas
ViewState("CliPais") = ObjCliente.Pais
ImprimeNombreSucursal = ObjCliente.ImprimeNombreSucursal
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
RegimenFiscalCliente = ObjCliente.DtResultados(0)("CodigoRegimenFiscal").ToString()
RegimenSociedad = ObjCliente.DtResultados(0)("RegimenSociedad").ToString()
TipoPersona = CBool(ObjCliente.DtResultados(0)("TipoPersona"))
CargaUsoCFDI()
End If
RegimenFiscalCliente = ObjCliente.DtResultados(0)("CodigoRegimenFiscal").ToString()
RegimenSociedad = ObjCliente.DtResultados(0)("RegimenSociedad").ToString()
TipoPersona = CBool(ObjCliente.DtResultados(0)("TipoPersona"))
CargaUsoCFDI()
'ViewState("NumCtaPago") = ObjCliente.NumCtaPago
ViewState("ClienteDesglosaIEPS") = ObjCliente.DesglosaIEPS
If Not ClienteDesglosaIEPS Then
@@ -6527,7 +6536,7 @@ Partial Class Ventas
End If
DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI)
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES
If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
If LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
'S01 Sin efectos fiscales.
DdlUsoCFDI.SelectedValueExist("23")
DdlUsoCFDI.Enabled = False
@@ -7061,7 +7070,7 @@ Partial Class Ventas
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO
If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
If Me.PermiteCredito = False AndAlso ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso EsCreaApartirDe) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) Then
RBLPago.SelectedValue = "2"
RBLPago.Items(0).Enabled = False
RBLPago_SelectedIndexChanged(Nothing, Nothing)
@@ -7459,9 +7468,9 @@ Partial Class Ventas
LblEstado.Text = ObjCliente.DtResultados.Rows(0)("Estado").ToString()
'TxtNumCtaPago.Text = ObjCliente.DtResultados.Rows(0)("NumCtaPago").ToString()
LblTelefono.Text = ObjCliente.DtResultados.Rows(0)("Telefono").ToString()
If Not UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
LblCP.Text = ObjCliente.DtResultados.Rows(0)("CP").ToString()
End If
'If Not UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
' LblCP.Text = ObjCliente.DtResultados.Rows(0)("CP").ToString()
'End If
ViewState("CliLocalidad") = ObjCliente.DtResultados.Rows(0)("Localidad").ToString()
ViewState("CliPais") = ObjCliente.DtResultados.Rows(0)("Pais").ToString()
ViewState("CliNoExt") = ObjCliente.DtResultados.Rows(0)("NoExt").ToString()
@@ -7518,7 +7527,7 @@ Partial Class Ventas
DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString())
DdlUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString())
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES
If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
If LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
'S01 Sin efectos fiscales.
DdlUsoCFDI.SelectedValueExist("23")
DdlUsoCFDI.Enabled = False
@@ -7560,7 +7569,7 @@ Partial Class Ventas
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33)
DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI)
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES
If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
If LblRFC.Text.Contiene("XAXX010101000", "XEXX010101000") Then
'S01 Sin efectos fiscales.
DdlUsoCFDI.SelectedValueExist("23")
DdlUsoCFDI.Enabled = False
@@ -8038,6 +8047,10 @@ Partial Class Ventas
End If
If UsuarioActual.Empresa.Funcionalidad(360) = "1" AndAlso e.Row.DBCampo("CvePrecioLista").ToEntero() > 0 Then
e.Row.FCLiteral("LtlPrecioLista").Visible = True
End If
'CANTIDAD FACTURADA
Select Case e.Row.DBCampo("TipoDocto")
Case "Cot"
@@ -8191,7 +8204,7 @@ Partial Class Ventas
Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If Costo = 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
If Costo <= 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
ObjInventarios.Dispose()
Dim PrecioMinimo As Decimal = 0
@@ -8748,7 +8761,7 @@ Partial Class Ventas
DtOCTmpDT = TmpDT.Copy
TmpDTError = TmpDT.Copy
If UsuarioActual.Empresa.Funcionalidad(350) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Egs", "Dev") Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Egs", "Dev") Then
If RegimenFiscalCliente.Contiene("-1", "") Then
Alert("El cliente no tiene asignado un régimen fiscal.", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -8759,6 +8772,7 @@ Partial Class Ventas
Exit Sub
End If
End If
If ChkEmitirComercioExterior.Checked AndAlso DdlMoneda.SelectedValue.ToEntero() <> 2 Then
Alert("La moneda de la factura debe ser dolares cuando aplica comercio exterior.", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -8769,7 +8783,7 @@ Partial Class Ventas
Exit Sub
End If
If UsuarioActual.Empresa.Funcionalidad(350) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Egs", "Dev") Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Egs", "Dev") Then
If LblRFC.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso RegimenFiscalCliente <> "616" Then
Alert("El Regimen fiscal del cliente debe ser <b>'616 - Sin obligaciones fiscales'</b> cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
@@ -9396,37 +9410,37 @@ Partial Class Ventas
End If
'Verifica versión 3.3.()
If (Not UsuarioActual.Empresa.Funcionalidad(350) = "1") AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then
Dim dttsat As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '' OR ISNULL(SATClaveUM,'') = '' ")
If dttsat IsNot Nothing AndAlso dttsat.Rows.Count > 0 Then
Dim str As New StringBuilder
str.Append("Los siguientes productos no tiene asignado la clave Producto SAT o Unidad Medida SAT<br/><br/>")
For Each drt As DataRow In dttsat.Rows
str.AppendFormat("{0} <br/>", drt("CodigoPS"))
Next
Alert(str.ToString(), TipoMensaje.MsgAdvertencia)
dttsat.Dispose()
str.Clear()
Exit Sub
End If
dttsat.Dispose()
'If (Not UsuarioActual.Empresa.Funcionalidad(350) = "1") AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then
' Dim dttsat As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '' OR ISNULL(SATClaveUM,'') = '' ")
' If dttsat IsNot Nothing AndAlso dttsat.Rows.Count > 0 Then
' Dim str As New StringBuilder
' str.Append("Los siguientes productos no tiene asignado la clave Producto SAT o Unidad Medida SAT<br/><br/>")
' For Each drt As DataRow In dttsat.Rows
' str.AppendFormat("{0} <br/>", drt("CodigoPS"))
' Next
' Alert(str.ToString(), TipoMensaje.MsgAdvertencia)
' dttsat.Dispose()
' str.Clear()
' Exit Sub
' End If
' dttsat.Dispose()
If UsuarioActual.CveEmpresa = 72 Then
Dim DtNoEncontrados As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '01010101' ")
If DtNoEncontrados IsNot Nothing AndAlso DtNoEncontrados.Rows.Count > 0 Then
Dim StrNoEncontrados As New StringBuilder
StrNoEncontrados.Append("Los siguientes productos no existen en el catálogo del SAT<br/><br/>")
For Each drt As DataRow In DtNoEncontrados.Rows
StrNoEncontrados.AppendFormat("{0} <br/>", drt("CodigoPS"))
Next
Alert(StrNoEncontrados.ToString(), TipoMensaje.MsgAdvertencia)
DtNoEncontrados.Dispose()
StrNoEncontrados.Clear()
Exit Sub
End If
DtNoEncontrados.Dispose()
End If
End If
' If UsuarioActual.CveEmpresa = 72 Then
' Dim DtNoEncontrados As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '01010101' ")
' If DtNoEncontrados IsNot Nothing AndAlso DtNoEncontrados.Rows.Count > 0 Then
' Dim StrNoEncontrados As New StringBuilder
' StrNoEncontrados.Append("Los siguientes productos no existen en el catálogo del SAT<br/><br/>")
' For Each drt As DataRow In DtNoEncontrados.Rows
' StrNoEncontrados.AppendFormat("{0} <br/>", drt("CodigoPS"))
' Next
' Alert(StrNoEncontrados.ToString(), TipoMensaje.MsgAdvertencia)
' DtNoEncontrados.Dispose()
' StrNoEncontrados.Clear()
' Exit Sub
' End If
' DtNoEncontrados.Dispose()
' End If
'End If
'CREA UNA COPIA DE SEGURIDAD PARA LOS DATOS DEL TMPDT
If TmpDTError Is Nothing OrElse TmpDTError.Rows.Count = 0 Then
@@ -10643,23 +10657,14 @@ Partial Class Ventas
ObjFacturaDevolucion.Fecha = Now
ObjFacturaDevolucion.Version = "4.0"
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
ObjFacturaDevolucion.Version = "4.0"
If ObjFacturaDevolucion.Cliente Is Nothing Then
ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel
End If
ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal
Else
ObjFacturaDevolucion.Version = "3.3"
If ObjFacturaDevolucion.Cliente Is Nothing Then
ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel
End If
ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal
ObjFacturaDevolucion.CveMetodoPago33 = 1
ObjFacturaDevolucion.MetodoPago33 = "Pago en una sola exhibición"
@@ -10942,20 +10947,15 @@ Partial Class Ventas
End If
ObjFacturaBonificacion.Fecha = Now
ObjFacturaBonificacion.Version = "4.0"
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
ObjFacturaBonificacion.Version = "4.0"
If ObjFacturaBonificacion.Cliente Is Nothing Then
ObjFacturaBonificacion.Cliente = New Modelos.ClienteModel
End If
ObjFacturaBonificacion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaBonificacion.Cliente.RegimenFiscal = ClienteRegimenFiscal
Else
ObjFacturaBonificacion.Version = "3.3"
If ObjFacturaBonificacion.Cliente Is Nothing Then
ObjFacturaBonificacion.Cliente = New Modelos.ClienteModel
End If
ObjFacturaBonificacion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaBonificacion.Cliente.RegimenFiscal = ClienteRegimenFiscal
ObjFacturaBonificacion.CveMetodoPago33 = 1
ObjFacturaBonificacion.MetodoPago33 = "Pago en una sola exhibición"
ObjFacturaBonificacion.ClaveMetodoPagoSAT = "PUE"
@@ -11368,18 +11368,14 @@ Partial Class Ventas
ObjFactura = New Modelos.Factura
End If
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
ObjFactura.Version = "4.0"
If ObjFactura.Cliente Is Nothing Then
ObjFactura.Cliente = New Modelos.ClienteModel
End If
ObjFactura.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFactura.Cliente.RegimenFiscal = ClienteRegimenFiscal
Else
ObjFactura.Version = "3.3"
ObjFactura.Version = "4.0"
If ObjFactura.Cliente Is Nothing Then
ObjFactura.Cliente = New Modelos.ClienteModel
End If
ObjFactura.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFactura.Cliente.RegimenFiscal = ClienteRegimenFiscal
ObjFactura.CveUsuario = UsuarioActual.CveUsuario
ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa
ObjFactura.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero() = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal)
@@ -12154,19 +12150,15 @@ Partial Class Ventas
ObjFacturaDevolucion.SerieFolioPadre = HdnFolioFiscalNC.Value.ToString()
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
ObjFacturaDevolucion.Version = "4.0"
ObjFacturaDevolucion.Version = "4.0"
If ObjFacturaDevolucion.Cliente Is Nothing Then
ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel
End If
ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal
Else
ObjFacturaDevolucion.Version = "3.3"
If ObjFacturaDevolucion.Cliente Is Nothing Then
ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel
End If
ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal
ObjFacturaDevolucion.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero()
ObjFacturaDevolucion.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero() > 0, DdlMetodoPago33.SelectedItem.Text, "")
ObjFacturaDevolucion.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}")
@@ -12412,7 +12404,7 @@ Partial Class Ventas
Dim Timbre As New CFDITimbre
Timbre.Comprobante.Version = If(UsuarioActual.Empresa.Funcionalidad(350) = "1", "4.0", "3.3")
Timbre.Comprobante.Version = "4.0"
Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", ""))
Timbre.Comprobante.Folio = Obj.Folio.ToString()
@@ -12441,11 +12433,7 @@ Partial Class Ventas
Timbre.Receptor.DomicilioFiscalReceptor = Obj.ClienteSucursal.CP
Else
Timbre.Receptor.RFC = Obj.Cliente.RFC
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
Timbre.Receptor.Nombre = Obj.Cliente.Nombre
Else
Timbre.Receptor.Nombre = Obj.Cliente.Nombre + " " + Obj.Cliente.RegimenSociedad
End If
Timbre.Receptor.Nombre = Obj.Cliente.Nombre
Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP
End If
@@ -13346,11 +13334,9 @@ Partial Class Ventas
For Each Row As DataRow In TmpDTDetalle.Rows
If Not ObjVentas.AddVentaDetalle(ObjVentas.CveVenta, Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDouble, Row("CveUM").ToString().ToEntero(),
Row("PU").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6),
Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(),
TiempoEntrega:=Row("TiempoEntrega").ToString(), CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(), CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=Row("CvePromocionDetalle").ToString().ToEntero(),
IEPS:=Row("ImporteIEPS").ToString().ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString().ToEntero(),
ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble,
PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString()) Then
Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), TiempoEntrega:=Row("TiempoEntrega").ToString(), CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(),
CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=Row("CvePromocionDetalle").ToString().ToEntero(), IEPS:=Row("ImporteIEPS").ToString().ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString().ToEntero(), ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble,
PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString(), CvePrecioLista:=Row("CvePrecioLista").ToString().ToEntero()) Then
ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Exit For
Else
@@ -14788,49 +14774,12 @@ Partial Class Ventas
CveVentaAmortizacionAplicar = ObjFactura.CveVenta
End If
''Cuando se está amortizando con un anticipo y es la modalidad de NC
'If ObjFactura.TipoDocto.Contiene("Ing") AndAlso CveAnticipo > 0 AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
' ConceptoContableAplicar = 11
' CveVentaAplicar = CveAnticipo
' CveVentaAmortizacionAplicar = ObjFactura.CveVenta
'End If
' If UsuarioActual.CveEmpresa = 119 Then
'código fijo en base el porcentaje iva, que se afecten las clasificaciones
'For i = 0 To TmpDTDetalle.Rows.Count - 1
' 'se excluyen las clasificaciones anteriores para que se asignen las de ingreso
' If Not TmpDTDetalle(i)("CveClasificacion").ToString().Contiene("19958", "19933", "18097", "24479") Then
' 'If TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal > 0 Then
' ' If TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal = 0.08 Then
' ' TmpDTDetalle(i)("CveClasificacion") = 20242 'clasif: ventas tasa 8%
' ' Else
' ' TmpDTDetalle(i)("CveClasificacion") = 19929 'clasif: ventas tasa 16%
' ' End If
' ' Else
' ' TmpDTDetalle(i)("CveClasificacion") = 19930 'clasif: ventas tasa 0%
' ' End If
' 'reclasifica la clasificación del producto, por la del ingreso correspondiente a su iva
' If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal).Rows.Count > 0 Then
' TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDecimal).Rows(0)("CveClasificacion").ToString()
' End If
' End If
'Next
' End If
DT = TmpDTDetalle.FiltraParametros($"CvePS <> {CvePSAmortizacion}", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA"})
If DT.Rows.Count > 0 Then
'Se agrega movimiento separado por la cuenta de ventas (ER)
For Each Row2 As DataRow In DT.Rows
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1} AND PorcentajeIVA = {2}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"))).ToString().ToDecimal()) * ValorMultiplicador
importeMX = importeMovimiento * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}"
@@ -14844,8 +14793,6 @@ Partial Class Ventas
End If
'CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero()
If importeMovimiento <> 0 Then
If IdCtaContable <= 0 Then
@@ -14871,37 +14818,12 @@ Partial Class Ventas
Dim CveVentaAplicar = ObjFactura.CveVenta
Dim CveVentaAmortizacionAplicar = -1
'If UsuarioActual.CveEmpresa = 119 Then
' 'código fijo en base el porcentaje iva, que se afecten las clasificaciones
' For i = 0 To TmpDTDetalle.Rows.Count - 1
' 'se excluyen las clasificaciones anteriores para que se asignen las de ingreso
' If Not TmpDTDetalle(i)("CveClasificacion").ToString().Contiene("19958", "19933", "18097") Then
' If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDouble).Rows.Count > 0 Then
' TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDTDetalle(i)("PorcentajeIVA").ToString().ToDouble).Rows(0)("CveClasificacion").ToString()
' End If
' End If
' Next
'End If
DT = TmpDTDetalle.FiltraParametros($"CvePS <> {CvePSAmortizacion}", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA"})
If DT.Rows.Count > 0 Then
'Se agrega movimiento separado por la cuenta de ventas (ER)
For Each Row2 As DataRow In DT.Rows
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
'If ObjFactura.TipoDocto = "Egs" Then
' importeMovimiento += (TmpDTDetalle.SUM("ImporteIVA", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
' importeMovimiento += (TmpDTDetalle.SUM("ImporteIEPS", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
' importeMovimiento -= (TmpDTDetalle.SUM("ImporteRetIVA", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
' importeMovimiento -= (TmpDTDetalle.SUM("ImporteRetISR", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
'End If
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1} AND PorcentajeIVA = {2}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"))).ToString().ToDecimal) * ValorMultiplicador
importeMX = importeMovimiento * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
@@ -14917,10 +14839,6 @@ Partial Class Ventas
IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero()
End If
If UsuarioActual.CveEmpresa = 119 Then
If Row2("CveClasificacion").ToString() = "19930" Then IdCtaContable = 1141
If Row2("CveClasificacion").ToString() = "19929" Then IdCtaContable = 1142
End If
If importeMovimiento <> 0 Then
@@ -17683,7 +17601,13 @@ Partial Class Ventas
Dim PrecioSugerido As Decimal = 0
Dim tPrecioSugerido As Decimal = 0
tPrecioSugerido = drPS("Precio").ToString().ToDecimal
PrecioSugerido = CalculaPrecioSugerido(CvePSParametro, drPS("CveClasificacion").ToString().ToEntero())
Dim ObjPrecioSugerido = CalculaPrecioSugerido(CvePSParametro, drPS("CveClasificacion").ToString().ToEntero())
PrecioSugerido = ObjPrecioSugerido.PrecioSugerido
If ObjPrecioSugerido.CvePrecioLista > 0 AndAlso DivPrecioLista.Visible Then
DdlPrecioLista.SelectedValueExist(ObjPrecioSugerido.CvePrecioLista)
End If
If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
@@ -17723,7 +17647,9 @@ Partial Class Ventas
End Sub
Private Function CalculaPrecioSugerido(CvePSParametro As Integer, CveClasificacion As Integer) As Decimal
Private Function CalculaPrecioSugerido(CvePSParametro As Integer, CveClasificacion As Integer, Optional CvePrecioListaSugerido As Integer = -1) As Modelos.MPrecioSugerido
Dim Retorno As New Modelos.MPrecioSugerido
Dim PrecioSugerido As Decimal = 0
If UsuarioActual.CveEmpresa.Contiene(1) Then
@@ -17766,6 +17692,10 @@ Partial Class Ventas
End If
If DivPrecioLista.Visible AndAlso CvePrecioListaSugerido > 0 Then
CvePrecioListaPS = CvePrecioListaSugerido
End If
If CvePrecioListaPS > 0 Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then
@@ -17785,7 +17715,8 @@ Partial Class Ventas
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
End If
End If
CvePrecioLista = CvePrecioListaPS
Me.CvePrecioLista = CvePrecioListaPS
Retorno.CvePrecioLista = CvePrecioListaPS
End If
@@ -17797,7 +17728,10 @@ Partial Class Ventas
PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1)
End If
End If
Return PrecioSugerido
Retorno.PrecioSugerido = PrecioSugerido
Return Retorno
End Function
Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero(), DdlPS)
@@ -18488,7 +18422,7 @@ Partial Class Ventas
Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If Costo = 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
If Costo <= 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
ObjInventarios.Dispose()
Dim PrecioMinimo As Decimal = 0
@@ -18884,11 +18818,29 @@ Partial Class Ventas
PU = ObjDescuento.PU
End If
Dim CvePrecioListaPS As Integer = -1
Dim PrecioListaPS As String = ""
'VALIDA LA ASIGNACION DE LISTA DE PRECIOS
If DivPrecioLista.Visible Then
If DdlPrecioLista.SelectedValue.ToEntero() > 0 AndAlso DdlPrecioLista.SelectedValue.ToEntero() = Me.CvePrecioLista Then
CvePrecioListaPS = Me.CvePrecioLista
PrecioListaPS = DdlPrecioLista.SelectedItem.Text
Else
Alert("La lista de precios del producto no coincide con la seleccionada", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Else
If Me.CvePrecioLista > 0 Then
CvePrecioListaPS = Me.CvePrecioLista
End If
End If
AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero(), DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero(), DdlClasificacion.SelectedItem.Text,
CvePS, "", TxtObsPS.Text.TrimEnd, PU, ObjDescuento.ImporteDescuento,
DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text,
Serie:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle,
ImporteProntoPago:=ObjDescuento.ImporteProntoPago, ObjDescuento:=ObjDescuento)
ImporteProntoPago:=ObjDescuento.ImporteProntoPago, ObjDescuento:=ObjDescuento, CvePrecioLista:=CvePrecioListaPS, PrecioLista:=PrecioListaPS)
CalculaUsados()
@@ -19079,7 +19031,7 @@ Partial Class Ventas
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 SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False,
Optional ImporteProntoPago As Decimal = 0, Optional ByRef ObjDescuento As Modelos.VentaDescuentos = Nothing) As Boolean
Optional ImporteProntoPago As Decimal = 0, Optional ByRef ObjDescuento As Modelos.VentaDescuentos = Nothing, Optional CvePrecioLista As Integer = -1, Optional PrecioLista As String = "") As Boolean
Dim Retorno As Boolean = False
Try
@@ -19335,6 +19287,9 @@ Partial Class Ventas
End If
Row("CvePrecioLista") = CvePrecioLista
Row("PrecioLista") = PrecioLista
If UsuarioActual.CveEmpresa.Contiene(119, 13, 83) Then
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
@@ -19569,6 +19524,9 @@ Partial Class Ventas
TmpDT.Columns.Add("CodigoObjetoImpuesto", GetType(String))
TmpDT.Columns.Add("CveMarca", GetType(Integer))
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
TmpDT.Columns.Add("PrecioLista", GetType(String))
TmpDT.Columns("EsOutSourcing").DefaultValue = False
TmpDT.Columns("EsCargo").DefaultValue = False
@@ -22295,7 +22253,7 @@ Partial Class Ventas
Row("PU").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6),
Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, IEPS:=Row("ImporteIEPS").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString(),
CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(), CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=If(DtPromociones IsNot Nothing, DtPromociones.FiltroPrimeroValor("CvePromocionDetalle", $"CvePS={Row("CvePS").ToString()}").ToEntero(), -1),
ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString()) Then
ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString(), CvePrecioLista:=Row("CvePrecioLista").ToString().ToEntero()) Then
OcurrioError = True
Exit For
Else
@@ -23478,7 +23436,7 @@ Partial Class Ventas
RFVCiudadC.Visible = False
RFVLocalidadC.Visible = False
RFVSATPais.Visible = False
divRegimenCliente.Visible = UsuarioActual.Empresa.Funcionalidad(350) = "1"
divRegimenCliente.Visible = True
RdTipoPersona.SelectedValue = "0"
@@ -23508,7 +23466,7 @@ Partial Class Ventas
DivCorreoCuentaCliente.Visible = True
DivBotonesAgregarCliente.Visible = True
DivFormaCliente.Visible = True
divRegimenCliente.Visible = UsuarioActual.Empresa.Funcionalidad(350) = "1"
divRegimenCliente.Visible = True
End If
End If
ObjCliente.Dispose()
@@ -23541,17 +23499,13 @@ Partial Class Ventas
Else
Dim RegimenFiscalCliente As String = "-1"
If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1") AndAlso DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then
If DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then
RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {DdlRegimenFiscalCliente.SelectedValue.ToEntero()}")
End If
DdlUsoCFDICliente.Items.Clear()
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
Else
DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente)
End If
Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
DdlUsoCFDICliente.DataBind()
DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
@@ -23573,44 +23527,41 @@ Partial Class Ventas
Dim CveRegimenFiscal As Integer = -1
Dim CveUsoCFDI As Integer = 3
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
CveRegimenFiscal = DdlRegimenFiscalCliente.SelectedValue.ToEntero()
CveUsoCFDI = DdlUsoCFDICliente.SelectedValue.ToEntero()
CveRegimenFiscal = DdlRegimenFiscalCliente.SelectedValue.ToEntero()
CveUsoCFDI = DdlUsoCFDICliente.SelectedValue.ToEntero()
Dim RegimenFiscalCliente As String = "-1"
Dim RegimenFiscalCliente As String = "-1"
If DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then
RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {CveRegimenFiscal}")
End If
If DdlRegimenFiscalCliente.SelectedValue.ToEntero() > 0 Then
RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {CveRegimenFiscal}")
End If
If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue <> "11" Then
Alert("El Regimen fiscal del cliente debe ser <b>'616 - Sin obligaciones fiscales'</b> cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue <> "11" Then
Alert("El Regimen fiscal del cliente debe ser <b>'616 - Sin obligaciones fiscales'</b> cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue <> "23" Then
Alert("El uso cfdi del cliente debe ser <b>'S01 - Sin efectos fiscales'</b> cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue <> "23" Then
Alert("El uso cfdi del cliente debe ser <b>'S01 - Sin efectos fiscales'</b> cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then
Alert("El Regimen fiscal del cliente no puede ser <b>'616 - Sin obligaciones fiscales'</b> si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscalCliente.SelectedValue = "11" Then
Alert("El Regimen fiscal del cliente no puede ser <b>'616 - Sin obligaciones fiscales'</b> si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue = "23" Then
Alert("El uso cfdi del cliente no puede ser <b>'S01 - Sin efectos fiscales'</b> si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If Not TxtRFCCliente.Text.Trim().ToUpper().Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDICliente.SelectedValue = "23" Then
Alert("El uso cfdi del cliente no puede ser <b>'S01 - Sin efectos fiscales'</b> si no se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
Dim DtUsosCFDI = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {CveUsoCFDI}")
If DtUsosCFDI.Rows.Count = 0 Then
Alert("El Uso CFDI no corresponde con el tipo de persona (fisca, moral) y el régimen fiscal.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
Dim DtUsosCFDI = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente).FiltraParametros($"CveUsoCFDI = {CveUsoCFDI}")
If DtUsosCFDI.Rows.Count = 0 Then
Alert("El Uso CFDI no corresponde con el tipo de persona (fisca, moral) y el régimen fiscal.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then
@@ -25672,7 +25623,8 @@ Partial Class Ventas
If CvePS > 0 Then
If PrecioUnitario <= 0 Then
PrecioUnitario = CalculaPrecioSugerido(CvePS, CveClasificacion)
Dim ObjPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
PrecioUnitario = ObjPrecioSugerido.PrecioSugerido
End If
AgregarProductoServicio(Cantidad, CveUM, UM, -1, "",
@@ -33056,6 +33008,10 @@ Partial Class Ventas
'REMOVER EVENTO PARA RECARGAR ALMACEN
'spanAlmacen.Attributes.Remove("onclick")
If UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
CargaListasPrecios()
End If
HdnCargarInventario.Value = "False"
UpParametros.Update()
@@ -34938,19 +34894,15 @@ Partial Class Ventas
ObjFacturaProntoPago.Fecha = Now
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
ObjFacturaProntoPago.Version = "4.0"
ObjFacturaProntoPago.Version = "4.0"
If ObjFacturaProntoPago.Cliente Is Nothing Then
ObjFacturaProntoPago.Cliente = New Modelos.ClienteModel
End If
ObjFacturaProntoPago.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaProntoPago.Cliente.RegimenFiscal = ClienteRegimenFiscal
Else
ObjFacturaProntoPago.Version = "3.3"
If ObjFacturaProntoPago.Cliente Is Nothing Then
ObjFacturaProntoPago.Cliente = New Modelos.ClienteModel
End If
ObjFacturaProntoPago.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaProntoPago.Cliente.RegimenFiscal = ClienteRegimenFiscal
ObjFacturaProntoPago.CveMetodoPago33 = 1
ObjFacturaProntoPago.MetodoPago33 = "Pago en una sola exhibición"
ObjFacturaProntoPago.ClaveMetodoPagoSAT = "PUE"
@@ -35354,7 +35306,8 @@ Partial Class Ventas
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
TmpDT.Columns.Add("CveMarca", GetType(Integer))
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
TmpDT.Columns.Add("PrecioLista", GetType(String))
Return TmpDT
End Function
Private Function InicializaDTVentasNCProntoPago() As DataTable
@@ -35653,40 +35606,36 @@ Partial Class Ventas
DVRegimenSociedad.Visible = False
DivRazonSocial2.Attributes.Add("class", "col-md-12")
If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then
DivRazonSocial2.Attributes.Add("class", "col-md-8")
DVRegimenSociedad.Visible = True
DivRazonSocial2.Attributes.Add("class", "col-md-8")
DVRegimenSociedad.Visible = True
If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then
DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales().FiltraParametros("CveRegimenFiscal = 11")
DdlRegimenFiscalCliente.DataBind()
Else
Dim dt As DataTable = GlobalDTRegimenesFiscales(RdTipoPersona.SelectedValue.ToEntero).FiltraParametros("", "CodigoRegimenFiscal")
Dim Val As String = ""
If TxtRFCCliente.Text.ToUpper = "XAXX010101000" Then
DdlRegimenFiscalCliente.DataSource = GlobalDTRegimenesFiscales().FiltraParametros("CveRegimenFiscal = 11")
DdlRegimenFiscalCliente.DataBind()
Else
Dim dt As DataTable = GlobalDTRegimenesFiscales(RdTipoPersona.SelectedValue.ToEntero).FiltraParametros("", "CodigoRegimenFiscal")
Dim Val As String = ""
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
'verifico que sino existe el valor. lo limpie
Val = dt.FiltroPrimeroValor("CveRegimenFiscal", "CveRegimenFiscal = " & DdlRegimenFiscalCliente.SelectedValue)
If Val = "" Then 'sino encuentra valor, lo limpia
DdlRegimenFiscalCliente.Items.Clear()
DdlRegimenFiscalCliente.SelectedValue = Nothing
End If
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
'verifico que sino existe el valor. lo limpie
Val = dt.FiltroPrimeroValor("CveRegimenFiscal", "CveRegimenFiscal = " & DdlRegimenFiscalCliente.SelectedValue)
If Val = "" Then 'sino encuentra valor, lo limpia
DdlRegimenFiscalCliente.Items.Clear()
DdlRegimenFiscalCliente.SelectedValue = Nothing
End If
DdlRegimenFiscalCliente.DataSource = dt
DdlRegimenFiscalCliente.DataBind()
DdlRegimenFiscalCliente.SelectedValueExist(Val)
End If
DdlRegimenFiscalCliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlUsoCFDICliente.Items.Clear()
DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlRegimenFiscalCliente.DataSource = dt
DdlRegimenFiscalCliente.DataBind()
DdlRegimenFiscalCliente.SelectedValueExist(Val)
End If
DdlRegimenFiscalCliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlUsoCFDICliente.Items.Clear()
DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
UpAgregarCliente.Update()
End Sub
@@ -36466,7 +36415,7 @@ Partial Class Ventas
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
End If
End If
CvePrecioLista = CvePrecioListaPS
Me.CvePrecioLista = CvePrecioListaPS
End If
@@ -36808,5 +36757,20 @@ Partial Class Ventas
End If
End Sub
Protected Sub DdlPrecioLista_SelectedIndexChanged(sender As Object, e As EventArgs)
If DivPrecioLista.Visible AndAlso DdlPrecioLista.SelectedValue.ToEntero() > 0 Then
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero()).FiltroPrimero("")
Dim ObjPrecioSugerido = CalculaPrecioSugerido(drPS("CvePS").ToString().ToEntero(), drPS("CveClasificacion").ToString().ToEntero(), CvePrecioListaSugerido:=DdlPrecioLista.SelectedValue.ToEntero())
If ObjPrecioSugerido.PrecioSugerido > 0 Then
TxtPrecio.Text = ObjPrecioSugerido.PrecioSugerido.ToString("#,###.####")
Else
Alert("No se encontro un precio para este producto en la lista de precios seleccionada")
End If
End If
End Sub
End Class