--Asignar lista de precios en ventas

This commit is contained in:
2023-05-09 16:22:00 -07:00
parent b62b1a1c46
commit b1bebe6e11
4 changed files with 268 additions and 212 deletions

View File

@@ -1325,7 +1325,7 @@ Public Class ClsVentas
CvePresupuestoIngreso As Integer, Optional TiempoEntrega As String = "", Optional CveVentaDetallePadre As Integer = -1, CvePresupuestoIngreso As Integer, Optional TiempoEntrega As String = "", Optional CveVentaDetallePadre As Integer = -1,
Optional CveContratoDetalle As Integer = -1, Optional PorcentajeIVA As Decimal = 0, Optional IEPS As Double = -1, Optional PorcentajeIEPS As Double = 0, Optional CvePromocionDetalle As Integer = -1, Optional CveContratoDetalle As Integer = -1, Optional PorcentajeIVA As Decimal = 0, Optional IEPS As Double = -1, Optional PorcentajeIEPS As Double = 0, Optional CvePromocionDetalle As Integer = -1,
Optional CveMovimientoDetallePedido As Integer = -1, Optional ImporteRetIVA As Double = 0, Optional PorcentajeRetIVA As Double = 0, Optional CveMovimientoDetallePedido As Integer = -1, Optional ImporteRetIVA As Double = 0, Optional PorcentajeRetIVA As Double = 0,
Optional ImporteRetISR As Double = 0, Optional PorcentajeRetISR As Double = 0, Optional CuentaPredial As String = "") As Boolean Optional ImporteRetISR As Double = 0, Optional PorcentajeRetISR As Double = 0, Optional CuentaPredial As String = "", Optional CvePrecioLista As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_VentasDetalleAdd") DataAdapter("PA_VentasDetalleAdd")
@@ -1355,6 +1355,7 @@ Public Class ClsVentas
.Add("@CvePromocionDetalle", SqlDbType.Int).Value = CvePromocionDetalle .Add("@CvePromocionDetalle", SqlDbType.Int).Value = CvePromocionDetalle
.Add("@CveMovimientoDetallePedido", SqlDbType.Int).Value = CveMovimientoDetallePedido .Add("@CveMovimientoDetallePedido", SqlDbType.Int).Value = CveMovimientoDetallePedido
.Add("@CuentaPredial", SqlDbType.VarChar).Value = CuentaPredial .Add("@CuentaPredial", SqlDbType.VarChar).Value = CuentaPredial
.Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista
End With End With
Try Try

View File

@@ -301,6 +301,11 @@ Namespace Modelos
#Region " OBJETOS Ventas" #Region " OBJETOS Ventas"
<Serializable>
Public Class MPrecioSugerido
Public Property CvePrecioLista As Integer
Public Property PrecioSugerido As Decimal
End Class
<Serializable> <Serializable>
Public Class VentaDescuentos Public Class VentaDescuentos
Public Consec As Integer Public Consec As Integer

View File

@@ -1066,12 +1066,21 @@
</asp:UpdatePanel> </asp:UpdatePanel>
</th> </th>
<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> <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="." /> <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> <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> <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> <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> <ajax:ValidatorCalloutExtender ID="VCEPrecio" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</th> </th>
<th id="thEncDesc2" runat="server" visible="true"></th> <th id="thEncDesc2" runat="server" visible="true"></th>
<th id="thPredial2" runat="server" visible="false"> <th id="thPredial2" runat="server" visible="false">
@@ -1207,7 +1216,16 @@
<%--9--%> <%--9--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right"> <asp:TemplateField ItemStyle-HorizontalAlign="Right">
<ItemTemplate> <ItemTemplate>
<div class="row">
<div class="col-md-12">
<asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU", "{0:N2}") %>'></asp:Literal> <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> </ItemTemplate>
<EditItemTemplate> <EditItemTemplate>
<asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU") %>' Visible="false"></asp:Literal> <asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU") %>' Visible="false"></asp:Literal>

View File

@@ -2734,6 +2734,9 @@ Partial Class Ventas
TmpDT.Columns.Add("TieneProntoPago", GetType(String)) TmpDT.Columns.Add("TieneProntoPago", GetType(String))
TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal)) TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
TmpDT.Columns.Add("CveMarca", GetType(Integer)) TmpDT.Columns.Add("CveMarca", GetType(Integer))
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
TmpDT.Columns.Add("PrecioLista", GetType(String))
GvPS.DataSource = ObjVentas.DtResultados GvPS.DataSource = ObjVentas.DtResultados
GvPS.DataBind() GvPS.DataBind()
@@ -2758,6 +2761,9 @@ Partial Class Ventas
TmpDT.Columns.Add("TieneProntoPago", GetType(String)) TmpDT.Columns.Add("TieneProntoPago", GetType(String))
TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal)) TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
TmpDT.Columns.Add("CveMarca", GetType(Integer)) TmpDT.Columns.Add("CveMarca", GetType(Integer))
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
TmpDT.Columns.Add("PrecioLista", GetType(String))
GvPS.DataSource = ObjVentas.DtResultados GvPS.DataSource = ObjVentas.DtResultados
GvPS.DataBind() GvPS.DataBind()
@@ -3125,6 +3131,11 @@ Partial Class Ventas
If Not ExFolioFactura Then SetPermisos() If Not ExFolioFactura Then SetPermisos()
If CveVenta < 1 Then CargaFolios() 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 'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE
'If UsuarioActual.CveVendedor > 0 Then 'If UsuarioActual.CveVendedor > 0 Then
' If CveVenta = -1 AndAlso Not DdlVendedor.SelectedValue.ToEntero() > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) ' 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 If
End Sub 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() Private Sub BloqueaClasificaciones()
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
DdlClasificacion.Enabled = False DdlClasificacion.Enabled = False
@@ -6076,12 +6102,6 @@ Partial Class Ventas
End Sub End Sub
Private Sub CargaFormaPago(CveMetodoPago As Integer) 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 Dim dtt As DataTable = Nothing
If CveMetodoPago > 0 Then If CveMetodoPago > 0 Then
dtt = GlobalDTVtaFormaPago.FiltraParametros(If(CveMetodoPago = 1, " CveFormaPago <> 20 ", "CveFormaPago = 20")) dtt = GlobalDTVtaFormaPago.FiltraParametros(If(CveMetodoPago = 1, " CveFormaPago <> 20 ", "CveFormaPago = 20"))
@@ -6117,22 +6137,13 @@ Partial Class Ventas
'End If 'End If
End Sub End Sub
Private Sub CargaUsoCFDI() Private Sub CargaUsoCFDI()
If UsuarioActual.Empresa.Funcionalidad(350) <> "1" Then
RegimenFiscalCliente = "-1"
End If
DdlUsoCFDI.Items.Clear() DdlUsoCFDI.Items.Clear()
DdlSucursalUsoCFDI.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) DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
DdlSucursalUsoCFDI.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.DataBind() DdlUsoCFDI.DataBind()
DdlSucursalUsoCFDI.DataBind() DdlSucursalUsoCFDI.DataBind()
@@ -6463,12 +6474,10 @@ Partial Class Ventas
ViewState("CliPais") = ObjCliente.Pais ViewState("CliPais") = ObjCliente.Pais
ImprimeNombreSucursal = ObjCliente.ImprimeNombreSucursal ImprimeNombreSucursal = ObjCliente.ImprimeNombreSucursal
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
RegimenFiscalCliente = ObjCliente.DtResultados(0)("CodigoRegimenFiscal").ToString() RegimenFiscalCliente = ObjCliente.DtResultados(0)("CodigoRegimenFiscal").ToString()
RegimenSociedad = ObjCliente.DtResultados(0)("RegimenSociedad").ToString() RegimenSociedad = ObjCliente.DtResultados(0)("RegimenSociedad").ToString()
TipoPersona = CBool(ObjCliente.DtResultados(0)("TipoPersona")) TipoPersona = CBool(ObjCliente.DtResultados(0)("TipoPersona"))
CargaUsoCFDI() CargaUsoCFDI()
End If
'ViewState("NumCtaPago") = ObjCliente.NumCtaPago 'ViewState("NumCtaPago") = ObjCliente.NumCtaPago
ViewState("ClienteDesglosaIEPS") = ObjCliente.DesglosaIEPS ViewState("ClienteDesglosaIEPS") = ObjCliente.DesglosaIEPS
If Not ClienteDesglosaIEPS Then If Not ClienteDesglosaIEPS Then
@@ -6527,7 +6536,7 @@ Partial Class Ventas
End If End If
DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI) DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI)
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES '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. 'S01 Sin efectos fiscales.
DdlUsoCFDI.SelectedValueExist("23") DdlUsoCFDI.SelectedValueExist("23")
DdlUsoCFDI.Enabled = False DdlUsoCFDI.Enabled = False
@@ -7061,7 +7070,7 @@ Partial Class Ventas
Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595) Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595)
'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO '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.SelectedValue = "2"
RBLPago.Items(0).Enabled = False RBLPago.Items(0).Enabled = False
RBLPago_SelectedIndexChanged(Nothing, Nothing) RBLPago_SelectedIndexChanged(Nothing, Nothing)
@@ -7459,9 +7468,9 @@ Partial Class Ventas
LblEstado.Text = ObjCliente.DtResultados.Rows(0)("Estado").ToString() LblEstado.Text = ObjCliente.DtResultados.Rows(0)("Estado").ToString()
'TxtNumCtaPago.Text = ObjCliente.DtResultados.Rows(0)("NumCtaPago").ToString() 'TxtNumCtaPago.Text = ObjCliente.DtResultados.Rows(0)("NumCtaPago").ToString()
LblTelefono.Text = ObjCliente.DtResultados.Rows(0)("Telefono").ToString() LblTelefono.Text = ObjCliente.DtResultados.Rows(0)("Telefono").ToString()
If Not UsuarioActual.Empresa.Funcionalidad(350) = "1" Then 'If Not UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
LblCP.Text = ObjCliente.DtResultados.Rows(0)("CP").ToString() ' LblCP.Text = ObjCliente.DtResultados.Rows(0)("CP").ToString()
End If 'End If
ViewState("CliLocalidad") = ObjCliente.DtResultados.Rows(0)("Localidad").ToString() ViewState("CliLocalidad") = ObjCliente.DtResultados.Rows(0)("Localidad").ToString()
ViewState("CliPais") = ObjCliente.DtResultados.Rows(0)("Pais").ToString() ViewState("CliPais") = ObjCliente.DtResultados.Rows(0)("Pais").ToString()
ViewState("CliNoExt") = ObjCliente.DtResultados.Rows(0)("NoExt").ToString() ViewState("CliNoExt") = ObjCliente.DtResultados.Rows(0)("NoExt").ToString()
@@ -7518,7 +7527,7 @@ Partial Class Ventas
DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString()) DdlFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString())
DdlUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString()) DdlUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString())
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES '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. 'S01 Sin efectos fiscales.
DdlUsoCFDI.SelectedValueExist("23") DdlUsoCFDI.SelectedValueExist("23")
DdlUsoCFDI.Enabled = False DdlUsoCFDI.Enabled = False
@@ -7560,7 +7569,7 @@ Partial Class Ventas
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33) DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33)
DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI) DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI)
'SI ES RFC GENERICO NO TIENE OBLIGACIONES FISCALES '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. 'S01 Sin efectos fiscales.
DdlUsoCFDI.SelectedValueExist("23") DdlUsoCFDI.SelectedValueExist("23")
DdlUsoCFDI.Enabled = False DdlUsoCFDI.Enabled = False
@@ -8038,6 +8047,10 @@ Partial Class Ventas
End If 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 'CANTIDAD FACTURADA
Select Case e.Row.DBCampo("TipoDocto") Select Case e.Row.DBCampo("TipoDocto")
Case "Cot" Case "Cot"
@@ -8748,7 +8761,7 @@ Partial Class Ventas
DtOCTmpDT = TmpDT.Copy DtOCTmpDT = TmpDT.Copy
TmpDTError = 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 If RegimenFiscalCliente.Contiene("-1", "") Then
Alert("El cliente no tiene asignado un régimen fiscal.", TipoMensaje.MsgAdvertencia) Alert("El cliente no tiene asignado un régimen fiscal.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
@@ -8759,6 +8772,7 @@ Partial Class Ventas
Exit Sub Exit Sub
End If End If
End If End If
If ChkEmitirComercioExterior.Checked AndAlso DdlMoneda.SelectedValue.ToEntero() <> 2 Then If ChkEmitirComercioExterior.Checked AndAlso DdlMoneda.SelectedValue.ToEntero() <> 2 Then
Alert("La moneda de la factura debe ser dolares cuando aplica comercio exterior.", TipoMensaje.MsgAdvertencia) Alert("La moneda de la factura debe ser dolares cuando aplica comercio exterior.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
@@ -8769,7 +8783,7 @@ Partial Class Ventas
Exit Sub Exit Sub
End If 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 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) 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 End If
'Verifica versión 3.3.() 'Verifica versión 3.3.()
If (Not UsuarioActual.Empresa.Funcionalidad(350) = "1") AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then '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,'') = '' ") ' Dim dttsat As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '' OR ISNULL(SATClaveUM,'') = '' ")
If dttsat IsNot Nothing AndAlso dttsat.Rows.Count > 0 Then ' If dttsat IsNot Nothing AndAlso dttsat.Rows.Count > 0 Then
Dim str As New StringBuilder ' Dim str As New StringBuilder
str.Append("Los siguientes productos no tiene asignado la clave Producto SAT o Unidad Medida SAT<br/><br/>") ' 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 ' For Each drt As DataRow In dttsat.Rows
str.AppendFormat("{0} <br/>", drt("CodigoPS")) ' str.AppendFormat("{0} <br/>", drt("CodigoPS"))
Next ' Next
Alert(str.ToString(), TipoMensaje.MsgAdvertencia) ' Alert(str.ToString(), TipoMensaje.MsgAdvertencia)
dttsat.Dispose() ' dttsat.Dispose()
str.Clear() ' str.Clear()
Exit Sub ' Exit Sub
End If ' End If
dttsat.Dispose() ' dttsat.Dispose()
If UsuarioActual.CveEmpresa = 72 Then ' If UsuarioActual.CveEmpresa = 72 Then
Dim DtNoEncontrados As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '01010101' ") ' Dim DtNoEncontrados As DataTable = TmpDT.FiltraParametros("ISNULL(SATClaveProdServ,'') = '01010101' ")
If DtNoEncontrados IsNot Nothing AndAlso DtNoEncontrados.Rows.Count > 0 Then ' If DtNoEncontrados IsNot Nothing AndAlso DtNoEncontrados.Rows.Count > 0 Then
Dim StrNoEncontrados As New StringBuilder ' Dim StrNoEncontrados As New StringBuilder
StrNoEncontrados.Append("Los siguientes productos no existen en el catálogo del SAT<br/><br/>") ' StrNoEncontrados.Append("Los siguientes productos no existen en el catálogo del SAT<br/><br/>")
For Each drt As DataRow In DtNoEncontrados.Rows ' For Each drt As DataRow In DtNoEncontrados.Rows
StrNoEncontrados.AppendFormat("{0} <br/>", drt("CodigoPS")) ' StrNoEncontrados.AppendFormat("{0} <br/>", drt("CodigoPS"))
Next ' Next
Alert(StrNoEncontrados.ToString(), TipoMensaje.MsgAdvertencia) ' Alert(StrNoEncontrados.ToString(), TipoMensaje.MsgAdvertencia)
DtNoEncontrados.Dispose() ' DtNoEncontrados.Dispose()
StrNoEncontrados.Clear() ' StrNoEncontrados.Clear()
Exit Sub ' Exit Sub
End If ' End If
DtNoEncontrados.Dispose() ' DtNoEncontrados.Dispose()
End If ' End If
End If 'End If
'CREA UNA COPIA DE SEGURIDAD PARA LOS DATOS DEL TMPDT 'CREA UNA COPIA DE SEGURIDAD PARA LOS DATOS DEL TMPDT
If TmpDTError Is Nothing OrElse TmpDTError.Rows.Count = 0 Then If TmpDTError Is Nothing OrElse TmpDTError.Rows.Count = 0 Then
@@ -10643,9 +10657,6 @@ Partial Class Ventas
ObjFacturaDevolucion.Fecha = Now ObjFacturaDevolucion.Fecha = Now
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
ObjFacturaDevolucion.Version = "4.0" ObjFacturaDevolucion.Version = "4.0"
If ObjFacturaDevolucion.Cliente Is Nothing Then If ObjFacturaDevolucion.Cliente Is Nothing Then
@@ -10654,12 +10665,6 @@ Partial Class Ventas
ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal
Else
ObjFacturaDevolucion.Version = "3.3"
End If
ObjFacturaDevolucion.CveMetodoPago33 = 1 ObjFacturaDevolucion.CveMetodoPago33 = 1
ObjFacturaDevolucion.MetodoPago33 = "Pago en una sola exhibición" ObjFacturaDevolucion.MetodoPago33 = "Pago en una sola exhibición"
@@ -10942,8 +10947,6 @@ Partial Class Ventas
End If End If
ObjFacturaBonificacion.Fecha = Now ObjFacturaBonificacion.Fecha = Now
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
ObjFacturaBonificacion.Version = "4.0" ObjFacturaBonificacion.Version = "4.0"
If ObjFacturaBonificacion.Cliente Is Nothing Then If ObjFacturaBonificacion.Cliente Is Nothing Then
@@ -10952,9 +10955,6 @@ Partial Class Ventas
ObjFacturaBonificacion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal ObjFacturaBonificacion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaBonificacion.Cliente.RegimenFiscal = ClienteRegimenFiscal ObjFacturaBonificacion.Cliente.RegimenFiscal = ClienteRegimenFiscal
Else
ObjFacturaBonificacion.Version = "3.3"
End If
ObjFacturaBonificacion.CveMetodoPago33 = 1 ObjFacturaBonificacion.CveMetodoPago33 = 1
ObjFacturaBonificacion.MetodoPago33 = "Pago en una sola exhibición" ObjFacturaBonificacion.MetodoPago33 = "Pago en una sola exhibición"
@@ -11368,7 +11368,6 @@ Partial Class Ventas
ObjFactura = New Modelos.Factura ObjFactura = New Modelos.Factura
End If End If
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
ObjFactura.Version = "4.0" ObjFactura.Version = "4.0"
If ObjFactura.Cliente Is Nothing Then If ObjFactura.Cliente Is Nothing Then
ObjFactura.Cliente = New Modelos.ClienteModel ObjFactura.Cliente = New Modelos.ClienteModel
@@ -11376,9 +11375,6 @@ Partial Class Ventas
ObjFactura.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal ObjFactura.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFactura.Cliente.RegimenFiscal = ClienteRegimenFiscal ObjFactura.Cliente.RegimenFiscal = ClienteRegimenFiscal
Else
ObjFactura.Version = "3.3"
End If
ObjFactura.CveUsuario = UsuarioActual.CveUsuario ObjFactura.CveUsuario = UsuarioActual.CveUsuario
ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa
@@ -12154,7 +12150,6 @@ Partial Class Ventas
ObjFacturaDevolucion.SerieFolioPadre = HdnFolioFiscalNC.Value.ToString() 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 If ObjFacturaDevolucion.Cliente Is Nothing Then
@@ -12163,9 +12158,6 @@ Partial Class Ventas
ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal
Else
ObjFacturaDevolucion.Version = "3.3"
End If
ObjFacturaDevolucion.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero() ObjFacturaDevolucion.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero()
ObjFacturaDevolucion.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero() > 0, DdlMetodoPago33.SelectedItem.Text, "") ObjFacturaDevolucion.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero() > 0, DdlMetodoPago33.SelectedItem.Text, "")
@@ -12412,7 +12404,7 @@ Partial Class Ventas
Dim Timbre As New CFDITimbre 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.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", ""))
Timbre.Comprobante.Folio = Obj.Folio.ToString() Timbre.Comprobante.Folio = Obj.Folio.ToString()
@@ -12441,11 +12433,7 @@ Partial Class Ventas
Timbre.Receptor.DomicilioFiscalReceptor = Obj.ClienteSucursal.CP Timbre.Receptor.DomicilioFiscalReceptor = Obj.ClienteSucursal.CP
Else Else
Timbre.Receptor.RFC = Obj.Cliente.RFC Timbre.Receptor.RFC = Obj.Cliente.RFC
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
Timbre.Receptor.Nombre = Obj.Cliente.Nombre Timbre.Receptor.Nombre = Obj.Cliente.Nombre
Else
Timbre.Receptor.Nombre = Obj.Cliente.Nombre + " " + Obj.Cliente.RegimenSociedad
End If
Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP
End If End If
@@ -13346,11 +13334,9 @@ Partial Class Ventas
For Each Row As DataRow In TmpDTDetalle.Rows 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(), 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("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(), 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(),
TiempoEntrega:=Row("TiempoEntrega").ToString(), CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(), CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=Row("CvePromocionDetalle").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,
IEPS:=Row("ImporteIEPS").ToString().ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString().ToEntero(), 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
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
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") 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 Exit For
Else Else
@@ -17615,7 +17601,13 @@ Partial Class Ventas
Dim PrecioSugerido As Decimal = 0 Dim PrecioSugerido As Decimal = 0
Dim tPrecioSugerido As Decimal = 0 Dim tPrecioSugerido As Decimal = 0
tPrecioSugerido = drPS("Precio").ToString().ToDecimal 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 If PrecioSugerido <= 0 Then PrecioSugerido = tPrecioSugerido
@@ -17655,7 +17647,9 @@ Partial Class Ventas
End Sub 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 Dim PrecioSugerido As Decimal = 0
If UsuarioActual.CveEmpresa.Contiene(1) Then If UsuarioActual.CveEmpresa.Contiene(1) Then
@@ -17698,6 +17692,10 @@ Partial Class Ventas
End If End If
If DivPrecioLista.Visible AndAlso CvePrecioListaSugerido > 0 Then
CvePrecioListaPS = CvePrecioListaSugerido
End If
If CvePrecioListaPS > 0 Then If CvePrecioListaPS > 0 Then
Dim ObjPS As New ClsProductosServicios Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then
@@ -17717,7 +17715,8 @@ Partial Class Ventas
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
End If End If
End If End If
CvePrecioLista = CvePrecioListaPS Me.CvePrecioLista = CvePrecioListaPS
Retorno.CvePrecioLista = CvePrecioListaPS
End If End If
@@ -17729,7 +17728,10 @@ Partial Class Ventas
PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1) PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1)
End If End If
End If End If
Return PrecioSugerido
Retorno.PrecioSugerido = PrecioSugerido
Return Retorno
End Function End Function
Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero(), DdlPS) DdlPSIndexChange(DdlPS.SelectedValue.ToEntero(), DdlPS)
@@ -18816,11 +18818,29 @@ Partial Class Ventas
PU = ObjDescuento.PU PU = ObjDescuento.PU
End If 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, AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero(), DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero(), DdlClasificacion.SelectedItem.Text,
CvePS, "", TxtObsPS.Text.TrimEnd, PU, ObjDescuento.ImporteDescuento, CvePS, "", TxtObsPS.Text.TrimEnd, PU, ObjDescuento.ImporteDescuento,
DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text, 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, 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() CalculaUsados()
@@ -19011,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 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 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 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 Dim Retorno As Boolean = False
Try Try
@@ -19267,6 +19287,9 @@ Partial Class Ventas
End If End If
Row("CvePrecioLista") = CvePrecioLista
Row("PrecioLista") = PrecioLista
If UsuarioActual.CveEmpresa.Contiene(119, 13, 83) Then If UsuarioActual.CveEmpresa.Contiene(119, 13, 83) Then
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
@@ -19501,6 +19524,9 @@ Partial Class Ventas
TmpDT.Columns.Add("CodigoObjetoImpuesto", GetType(String)) TmpDT.Columns.Add("CodigoObjetoImpuesto", GetType(String))
TmpDT.Columns.Add("CveMarca", GetType(Integer)) 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("EsOutSourcing").DefaultValue = False
TmpDT.Columns("EsCargo").DefaultValue = False TmpDT.Columns("EsCargo").DefaultValue = False
@@ -22227,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("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(), 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), 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 OcurrioError = True
Exit For Exit For
Else Else
@@ -23410,7 +23436,7 @@ Partial Class Ventas
RFVCiudadC.Visible = False RFVCiudadC.Visible = False
RFVLocalidadC.Visible = False RFVLocalidadC.Visible = False
RFVSATPais.Visible = False RFVSATPais.Visible = False
divRegimenCliente.Visible = UsuarioActual.Empresa.Funcionalidad(350) = "1" divRegimenCliente.Visible = True
RdTipoPersona.SelectedValue = "0" RdTipoPersona.SelectedValue = "0"
@@ -23440,7 +23466,7 @@ Partial Class Ventas
DivCorreoCuentaCliente.Visible = True DivCorreoCuentaCliente.Visible = True
DivBotonesAgregarCliente.Visible = True DivBotonesAgregarCliente.Visible = True
DivFormaCliente.Visible = True DivFormaCliente.Visible = True
divRegimenCliente.Visible = UsuarioActual.Empresa.Funcionalidad(350) = "1" divRegimenCliente.Visible = True
End If End If
End If End If
ObjCliente.Dispose() ObjCliente.Dispose()
@@ -23473,17 +23499,13 @@ Partial Class Ventas
Else Else
Dim RegimenFiscalCliente As String = "-1" 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()}") RegimenFiscalCliente = GlobalDTRegimenesFiscales().FiltroPrimeroValor("CodigoRegimenFiscal", $"CveRegimenFiscal = {DdlRegimenFiscalCliente.SelectedValue.ToEntero()}")
End If End If
DdlUsoCFDICliente.Items.Clear() DdlUsoCFDICliente.Items.Clear()
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1") Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1")
DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente) DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente)
Else
DdlUsoCFDICliente.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente)
End If
DdlUsoCFDICliente.DataBind() DdlUsoCFDICliente.DataBind()
DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
@@ -23505,7 +23527,6 @@ Partial Class Ventas
Dim CveRegimenFiscal As Integer = -1 Dim CveRegimenFiscal As Integer = -1
Dim CveUsoCFDI As Integer = 3 Dim CveUsoCFDI As Integer = 3
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
CveRegimenFiscal = DdlRegimenFiscalCliente.SelectedValue.ToEntero() CveRegimenFiscal = DdlRegimenFiscalCliente.SelectedValue.ToEntero()
CveUsoCFDI = DdlUsoCFDICliente.SelectedValue.ToEntero() CveUsoCFDI = DdlUsoCFDICliente.SelectedValue.ToEntero()
@@ -23543,8 +23564,6 @@ Partial Class Ventas
Exit Sub Exit Sub
End If End If
End If
If DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then If DdlSubProyectoDatos.SelectedValue.ToEntero() > 0 Then
Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa).Rows(0) Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa).Rows(0)
If Dr IsNot Nothing Then If Dr IsNot Nothing Then
@@ -25604,7 +25623,8 @@ Partial Class Ventas
If CvePS > 0 Then If CvePS > 0 Then
If PrecioUnitario <= 0 Then If PrecioUnitario <= 0 Then
PrecioUnitario = CalculaPrecioSugerido(CvePS, CveClasificacion) Dim ObjPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
PrecioUnitario = ObjPrecioSugerido.PrecioSugerido
End If End If
AgregarProductoServicio(Cantidad, CveUM, UM, -1, "", AgregarProductoServicio(Cantidad, CveUM, UM, -1, "",
@@ -32988,6 +33008,10 @@ Partial Class Ventas
'REMOVER EVENTO PARA RECARGAR ALMACEN 'REMOVER EVENTO PARA RECARGAR ALMACEN
'spanAlmacen.Attributes.Remove("onclick") 'spanAlmacen.Attributes.Remove("onclick")
If UsuarioActual.Empresa.Funcionalidad(360) = "1" Then
CargaListasPrecios()
End If
HdnCargarInventario.Value = "False" HdnCargarInventario.Value = "False"
UpParametros.Update() UpParametros.Update()
@@ -34870,7 +34894,6 @@ Partial Class Ventas
ObjFacturaProntoPago.Fecha = Now ObjFacturaProntoPago.Fecha = Now
If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then
ObjFacturaProntoPago.Version = "4.0" ObjFacturaProntoPago.Version = "4.0"
If ObjFacturaProntoPago.Cliente Is Nothing Then If ObjFacturaProntoPago.Cliente Is Nothing Then
@@ -34879,9 +34902,6 @@ Partial Class Ventas
ObjFacturaProntoPago.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal ObjFacturaProntoPago.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal
ObjFacturaProntoPago.Cliente.RegimenFiscal = ClienteRegimenFiscal ObjFacturaProntoPago.Cliente.RegimenFiscal = ClienteRegimenFiscal
Else
ObjFacturaProntoPago.Version = "3.3"
End If
ObjFacturaProntoPago.CveMetodoPago33 = 1 ObjFacturaProntoPago.CveMetodoPago33 = 1
ObjFacturaProntoPago.MetodoPago33 = "Pago en una sola exhibición" ObjFacturaProntoPago.MetodoPago33 = "Pago en una sola exhibición"
@@ -35286,7 +35306,8 @@ Partial Class Ventas
TmpDT.Columns.Add("CveTamaño", GetType(Integer)) TmpDT.Columns.Add("CveTamaño", GetType(Integer))
TmpDT.Columns.Add("EsCargo", GetType(Boolean)) TmpDT.Columns.Add("EsCargo", GetType(Boolean))
TmpDT.Columns.Add("CveMarca", GetType(Integer)) TmpDT.Columns.Add("CveMarca", GetType(Integer))
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
TmpDT.Columns.Add("PrecioLista", GetType(String))
Return TmpDT Return TmpDT
End Function End Function
Private Function InicializaDTVentasNCProntoPago() As DataTable Private Function InicializaDTVentasNCProntoPago() As DataTable
@@ -35585,8 +35606,6 @@ Partial Class Ventas
DVRegimenSociedad.Visible = False DVRegimenSociedad.Visible = False
DivRazonSocial2.Attributes.Add("class", "col-md-12") DivRazonSocial2.Attributes.Add("class", "col-md-12")
If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then
DivRazonSocial2.Attributes.Add("class", "col-md-8") DivRazonSocial2.Attributes.Add("class", "col-md-8")
DVRegimenSociedad.Visible = True DVRegimenSociedad.Visible = True
@@ -35617,8 +35636,6 @@ Partial Class Ventas
DdlUsoCFDICliente.Items.Clear() DdlUsoCFDICliente.Items.Clear()
DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlUsoCFDICliente.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
UpAgregarCliente.Update() UpAgregarCliente.Update()
End Sub End Sub
@@ -36398,7 +36415,7 @@ Partial Class Ventas
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
End If End If
End If End If
CvePrecioLista = CvePrecioListaPS Me.CvePrecioLista = CvePrecioListaPS
End If End If
@@ -36740,5 +36757,20 @@ Partial Class Ventas
End If End If
End Sub 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 End Class