This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2020-01-16 10:58:13 -07:00
22 changed files with 3913 additions and 3782 deletions

View File

@@ -758,11 +758,12 @@ Public Class ClsAcumuladores
End Try
Return Retorno
End Function
Public Function GetGarantiasPolizaVirtual(CveVenta As Integer) As Boolean
Public Function GetGarantiasPolizaVirtual(CveVenta As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_GarantiasPolizaVirtualGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)

View File

@@ -5778,6 +5778,8 @@ Public Class ClsContabilidad
ValorPolizaDescuadre = SqlAdapter.SelectCommand.Parameters("@Valor").Value.ToString.ToEntero
MensajePolizaDescuadre = SqlAdapter.SelectCommand.Parameters("@MsgSalida").Value.ToString
ValorDiferencia = SqlAdapter.SelectCommand.Parameters("@Diferencia").Value.ToString
Dim MsgPrePoliza As String = SqlAdapter.SelectCommand.Parameters("@MsgPrePolizaSalida").Value.ToString
If MsgPrePoliza <> "" Then MsgPrePoliza.GuardaLogAD("LogPrePoliza")
Catch ex As Exception
OnError("Ocurrió un error al validar la PrePoliza.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try

View File

@@ -1267,7 +1267,13 @@ Public Class ClsOC
_CveOrdenCompraDetalle = SqlAdapter.SelectCommand.Parameters("@vCveOrdenCompraDetalle").Value.ToString.ToEntero
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al agregar el detalle de OrdenCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
If ex.Message.Contains("CK_OC_OrdenesCompraDetalle_RetIVA_Total") Then
OnError("La retención de iva no coincide con su total", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
Else
OnError("Ocurrió un error al agregar el detalle de OrdenCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End If
End Try
Return Retorno

View File

@@ -99,6 +99,7 @@ Public Class ClsProductosServicios
Public Property ClaveImpuestoUnidadMedida As String
Public Property ClaveCategoriaToxicidad As String
Public Property EsOutSourcing As Boolean
Public ReadOnly Property DtResultados() As DataTable
Get
@@ -290,7 +291,7 @@ Public Class ClsProductosServicios
ClaveImpuestoEmpaque = Data.Rows(0)("ClaveImpuestoEmpaque").ToString
ClaveImpuestoUnidadMedida = Data.Rows(0)("ClaveImpuestoUM").ToString
ClaveCategoriaToxicidad = Data.Rows(0)("ClaveCategoriaToxicidad").ToString
EsOutSourcing = Data.Rows(0)("EsOutSourcing").ToString = "True"
End If
Retorno = True
Catch ex As SqlException
@@ -388,7 +389,7 @@ Public Class ClsProductosServicios
Optional CveMoneda As Integer = 1, Optional RetISR As Double = 0, Optional PrecioMinimo As Decimal = Nothing, Optional CveTipoFactor As Integer = 1,
Optional CveFraccionArancelaria As Integer = -1, Optional CveClasificacionDetalle As Integer = -1, Optional CveTamaño As Integer = -1,
Optional CveModelo As Integer = -1, Optional CveMedida As Integer = -1, Optional CveRinTamaño As Integer = -1, Optional ClaveImpuestoEmpaque As String = "", Optional ClaveImpuestoUM As String = "",
Optional ClaveCategoriaToxicidad As String = "", Optional ClaveImpuestoTipoProducto As String = "", Optional Litraje As Double = -1) As Integer
Optional ClaveCategoriaToxicidad As String = "", Optional ClaveImpuestoTipoProducto As String = "", Optional Litraje As Double = -1, Optional EsOutSourcing As Boolean = False) As Integer
Dim Retorno As Integer = -1
DataAdapter("PA_ProductosServiciosAdd")
@@ -461,7 +462,7 @@ Public Class ClsProductosServicios
.Add("@ClaveImpuestoUM", SqlDbType.VarChar).Value = ClaveImpuestoUM
.Add("@ClaveCategoriaToxicidad", SqlDbType.VarChar).Value = ClaveCategoriaToxicidad
.Add("@Litraje", SqlDbType.Float).Value = Litraje
.Add("@EsOutSourcing", SqlDbType.Bit).Value = EsOutSourcing
End With
Try
@@ -607,7 +608,7 @@ Public Class ClsProductosServicios
Optional CveMoneda As Integer = 1, Optional RetISR As Double = 0, Optional PrecioMinimo As Decimal = Nothing, Optional CveTipoFactor As Integer = 1,
Optional CveFraccionArancelaria As Integer = -1, Optional CveUsuarioModifico As Integer = -1,
Optional CveClasificacionDetalle As Integer = -1, Optional CveTamaño As Integer = -1, Optional CveModelo As Integer = -1, Optional CveMedida As Integer = -1, Optional CveRinTamaño As Integer = -1, Optional ClaveImpuestoEmpaque As String = "", Optional ClaveImpuestoUM As String = "",
Optional ClaveCategoriaToxicidad As String = "", Optional ClaveImpuestoTipoProducto As String = "", Optional Litraje As Double = -1) As Boolean
Optional ClaveCategoriaToxicidad As String = "", Optional ClaveImpuestoTipoProducto As String = "", Optional Litraje As Double = -1, Optional EsOutSourcing As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_ProductosServiciosUpdate")
@@ -681,7 +682,7 @@ Public Class ClsProductosServicios
.Add("@ClaveImpuestoUM", SqlDbType.VarChar).Value = ClaveImpuestoUM
.Add("@ClaveCategoriaToxicidad", SqlDbType.VarChar).Value = ClaveCategoriaToxicidad
.Add("@Litraje", SqlDbType.Float).Value = Litraje
.Add("@EsOutSourcing", SqlDbType.Bit).Value = EsOutSourcing
End With
Try

View File

@@ -65,17 +65,18 @@
<br />
<br />
<asp:GridView ID="GvCompras" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveCompra,CveProveedor,Fluctuacion,SerieFolio"
DataKeyNames="CveCompra,CveProveedor,Fluctuacion,SerieFolio,FluctuacionTotal,GananciaPerdida"
EmptyDataText="No se Encontraron compras pendientes de pagar." ToolTip="Listado de Compras"
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField HeaderText="Proveedor" DataTextField="NombreComercial" Target="_blank" ItemStyle-HorizontalAlign="Left" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataNavigateUrlFields="CveProveedor" />
<asp:BoundField HeaderText="# Facturas" DataField="SerieFolio" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Saldo USD" DataField="Saldo" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Fluctuación Pesos" DataField="Fluctuacion" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Fluctuación Pesos" DataField="FluctuacionTotal" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Perdida o Ganancia" DataField="GananciaPerdida" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
<asp:Label ID="LblTotalCompras" runat="server" Text=""></asp:Label>
<%--<asp:Label ID="LblTotalCompras" runat="server" Text=""></asp:Label>--%>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabVentas" HeaderText="Ventas">

View File

@@ -7,7 +7,14 @@ Partial Class Bancos_FluctuacionCambiaria
Inherits ClsPaginas
#Region "PROPIEDADES"
Private Property LblTotal() As String
Get
Return ViewState("Total").ToString
End Get
Set(value As String)
ViewState("Total") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
@@ -60,16 +67,20 @@ Partial Class Bancos_FluctuacionCambiaria
Private Sub CargaDatosCompra()
Dim ObjBancos As New ClsBancos
LblTotalCompras.Text = "0.00"
'LblTotalCompras.Text = "0.00"
If ObjBancos.GetFluctuaciones(TxtFecha.Text.ToDate, 1, UsuarioActual.CveEmpresa) Then
GvCompras.DataSource = ObjBancos.DtResultados
LblTotalCompras.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
'LblTotalCompras.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
LblTotal = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
Else
GvCompras.DataSource = Nothing
Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia)
End If
ObjBancos.Dispose()
GvCompras.DataBind()
If GvCompras.Rows.Count > 0 Then
GvCompras.Rows(GvCompras.Rows.Count - 1).CssClass = "SubTotales2"
End If
End Sub
Private Sub CargaDatosVentas()
@@ -201,7 +212,7 @@ Partial Class Bancos_FluctuacionCambiaria
Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias
Total = LblTotalCompras.Text.ToDecimal
Total = LblTotal.ToDecimal
If Total > 0 Then
CveConceptoContable = 64
CveCuenta = CveCuentaGanancia

View File

@@ -907,8 +907,10 @@
<td runat="server" id="tdT5" visible="false">
<asp:Label Text="" ID="LbIVAOriginal" runat="server" />
</td>
<td runat="server" id="tdIVA6" visible="false">
<asp:LinkButton runat="server" ID="LnkActivaIva6" Text="" ToolTip="Ret IVA Servicios" OnClick="LnkActivaIva6_Click"><i class="fa fa-usd" aria-hidden="true"></i></asp:LinkButton>
<td runat="server" id="tdIVA6" visible="false" class="label label-sm label-success" style="color:white!important" >
<asp:LinkButton runat="server" ID="LnkActivaIva6" Text="" ToolTip="Ret IVA Servicios" OnClick="LnkActivaIva6_Click" style="color:white!important" >Deglose 6%</asp:LinkButton>
<%--<asp:LinkButton runat="server" ID="LnkActivaIva6" Text="" ToolTip="Ret IVA Servicios" OnClick="LnkActivaIva6_Click"><i class="fa fa-usd" aria-hidden="true"></i></asp:LinkButton>--%>
</td>
<%--<td align="left" runat="server" id="TdIVA" visible="false">

View File

@@ -1025,10 +1025,17 @@ Partial Class Compras_Compras
Set(value As Double)
ViewState("SubTotal2Original") = value
End Set
End Property
End Property
Private Property IVAOriginal As Double
Get
Return ViewState("IVAOriginal").ToString.ToDouble
Get
If ViewState("IVAOriginal") Is Nothing Then
Return 0
Else
Return ViewState("IVAOriginal").ToString.ToDouble
End If
End Get
Set(value As Double)
ViewState("IVAOriginal") = value
@@ -2087,8 +2094,12 @@ Partial Class Compras_Compras
End If
DdlRetIVAConcepto.Items.Add(New ListItem("Arrendamiento", "4"))
DdlRetIVAConcepto.Items.Add(New ListItem("Ret IVA Servicios", "5"))
If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then
DdlRetIVAConcepto.Items.Add(New ListItem("Ret IVA Servicios", "5"))
End If
End If
@@ -2237,15 +2248,15 @@ Partial Class Compras_Compras
If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then
'If UsuarioActual.CveRol = 1 Then
' Alert("Ok funcionalidad 577")
'End If
If RetencionIVA = 0 And IVAOriginal > 0 Then
For Each dRow As DataRow In TmpDT.Rows
If dRow("CveTipoPS").ToString.ToEntero = 1 Then
tdIVA6.Visible = True
'comentado para reubicar el boton
'tdIVA6.Visible = True
Exit For
End If
Next
@@ -17024,8 +17035,9 @@ Partial Class Compras_Compras
If RetencionIVA = 0 And IVAOriginal > 0 Then
For Each dRow As DataRow In TmpDT.Rows
If dRow("CveTipoPS").ToString.ToEntero = 1 Then
tdIVA6.Visible = True
If dRow("CveTipoPS").ToString.ToEntero = 1 Then
'Comnetado para reubicar el boton
'tdIVA6.Visible = True
Exit For
End If
Next
@@ -19305,7 +19317,7 @@ Partial Class Compras_Compras
DdlRetIVAConcepto.SelectedValueExist("5")
LblRetIVA.Text = "0.06%"
LblRetIVA.Text = "6.0%"
RetencionIVA = TmpDT.SUMD("RetIVA")
TxtRetIVA.Text = RetencionIVA.ToString("###,###,###.00")

View File

@@ -434,7 +434,7 @@ Partial Class Compras_ReembolsosComprobaciones
End If
End If
Dim FolioIENew = ObjIE.GetNextFolio(If(CveCajaChica > 0, CveCajaChica, CvePersonal), 8).ToString
CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 8, TxtFechaDocumento.Text.Trim.ToDate, FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporteVinculado.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False))
CveIECajaChica = ObjIE.AddBancos_IE(CveCajaChica, 8, If(ChkReembolsarSinBancos.Checked, TxtFechaPrePoliza.Text.ToDate, TxtFechaDocumento.Text.Trim.ToDate), FolioIENew, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), TxtImporteVinculado.Text.ToDecimal, CveMoneda, 0, TxtObservaciones.Text.Trim, "", False, False, -1, CvePrePolizaIERegistrado, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False))
'AGREGO PREPOLIZA IE BANCOS
If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaIERegistrado, True, TxtImporteVinculado.Text.ToDecimal, String.Format("Transferencia Cta: {0}", DdlCajaChica.SelectedItem), 30, TxtObservaciones.Text, TxtFechaDocumento.Text.ToDate, IdCuentaBancaria, -1, CveIE:=CveIECajaChica, ImporteME:=If(tipoCambio = 1, 0, TxtImporteVinculado.Text.ToDecimal), ImporteMX:=TxtImporteVinculado.Text.ToDecimal * tipoCambio) Then
MsgError = "Error al registrar detalle de concepto bancario"

View File

@@ -2815,6 +2815,9 @@ Partial Class Compras_eFacturas
CveProveedor = gvRow.DataKey("CveProveedor").ToEntero
Dim ObjCompras As New ClsCompras
Dim TieneRegistros As Boolean = False
If ObjCompras.GetCompararComplementoPago(gvRow.DataKey("CveProveedor").ToEntero, Monto, nodePagos2.InnerXml.Replace("pago10:", ""), UsuarioActual.CveEmpresa) Then
GvVincularPago.DataSource = ObjCompras.DtResultados
@@ -2822,7 +2825,7 @@ Partial Class Compras_eFacturas
SerieFolioIE = ObjCompras.DtResultados.Rows(0)("SerieFolio").ToString
DivVincularPagoManualmente.Visible = False
BtnVincularPago.Visible = True
TieneRegistros = True
Else
DivVincularPagoManualmente.Visible = True
BtnVincularPago.Visible = False
@@ -2835,6 +2838,7 @@ Partial Class Compras_eFacturas
For Each drow As DataRow In ObjCompras.DtResultados.FiltraParametros("CveIE > 0 AND FechaDocumento IS NOT NULL", "", {"FechaDocumento"}).Rows
Dim FechaDocumento As Date = drow("FechaDocumento").ToString.ToDate
@@ -2873,12 +2877,18 @@ Partial Class Compras_eFacturas
TextoDiferenciaImporte = $"<b>&nbsp;&nbsp;-&nbsp;&nbsp; IE ${ImporteIES.FormatoNumero}</b> <div style='color:red'><strong>Diferencia { DiferenciaImportes.FormatoNumero() }</strong></div>"
BtnVincularPago.Visible = False
MSGComplemento = MSGComplemento & $" Existe una diferencia mayor a $5.00 ({Math.Abs(DiferenciaImportes)})"
If TieneRegistros AndAlso UsuarioActual.TienePermisoProceso(286) Then
DivVincularPagoManualmente.Visible = True
End If
Else
'BtnVincularPago.Visible = True
'TextoDiferenciaImporte = ""
End If
LblSerieFolioPago.Text = $"{SeriePago}-{FolioPago}"
LblImportePago.Text = Monto.ToString("###,###,###.00") 'ImportePago.FormatoNumero
LblPagosCantidad.Text = PagosCantidad.ToString
@@ -2893,7 +2903,7 @@ Partial Class Compras_eFacturas
Else
LblMensajeComlementoError.Text = ""
DVMensajecomplementoError.Visible = False
DivVincularPagoManualmente.Visible = False
End If

View File

@@ -462,6 +462,13 @@
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" Width="300px" />
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>TC</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlTC" runat="server" Text='<%# String.Format("{0}-${1}", Eval("TC"), Eval("ImporteME", "{0:N2}")) %>'></asp:Literal><br />
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" Width="300px" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Cargo</HeaderTemplate>
<ItemTemplate>

View File

@@ -396,6 +396,10 @@ Partial Class ContabilidadC_RegPrePoliza
GvPrePoliza.DataSource = DtMovimientos
GvPrePoliza.DataBind()
If UsuarioActual.CveRol = 1 AndAlso DtMovimientos.COUNT("TC", "TC > 1") > 0 Then
GvPrePoliza.Columns(7).Visible = True
End If
If DtMovimientos.FiltraParametros("CveConceptoContable IN (2,17)").Rows.Count > 0 Then
LnkComplementoPago.Visible = True
End If

View File

@@ -1334,7 +1334,7 @@
<Width>8.01986in</Width>
<Page>
<PageHeader>
<Height>0.81597in</Height>
<Height>1.14931in</Height>
<PrintOnFirstPage>true</PrintOnFirstPage>
<PrintOnLastPage>true</PrintOnLastPage>
<ReportItems>
@@ -1444,23 +1444,32 @@
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Cuenta: </Value>
<Style>
<FontFamily>Verdana</FontFamily>
<FontSize>8pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
<TextRun>
<Value>=Parameters!Cuenta.Value</Value>
<Style>
<FontSize>11pt</FontSize>
<FontFamily>Verdana</FontFamily>
<FontSize>8pt</FontSize>
<FontWeight>Bold</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Center</TextAlign>
<TextAlign>Left</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Cuenta</rd:DefaultName>
<Top>0.47708in</Top>
<Left>1.82615in</Left>
<Top>0.84375in</Top>
<Height>0.25in</Height>
<Width>4.42313in</Width>
<Width>5.42127in</Width>
<ZIndex>3</ZIndex>
<Style>
<Border>

View File

@@ -625,10 +625,10 @@ Partial Class Inventarios_RecepcionEntrega
Dim Filtro As String '= If(ObjInventario.DtResultados.Rows(0)("TipoDocto").ToString.Contiene({"Ing", "Dev", "Ped"}), "CveConcepto = 3", "CveConcepto = 9")
Select Case ObjInventario.DtResultados.Rows(0)("TipoDocto").ToString
Case "Ing", "Ped"
Filtro = "CveConcepto = 3"
Filtro = "CveConcepto IN (3,40)"
Case "Dev"
'cuand es devolucionventa=1, es cancelación de la devolución
If EsDevolucionVenta = 1 Then Filtro = "CveConcepto = 18" Else Filtro = "CveConcepto = 3"
If EsDevolucionVenta = 1 Then Filtro = "CveConcepto = 18" Else Filtro = "CveConcepto IN (3,40)"
Case Else
Filtro = "CveConcepto = 9"
End Select
@@ -1640,7 +1640,7 @@ Partial Class Inventarios_RecepcionEntrega
Dim CantidadSaldo As Decimal = 0
If CveVendedor > 0 AndAlso (UsuarioActual.Empresa.Funcionalidad(146) = "1" Or CveCliente > 0) AndAlso TipoDocto <> "Ped" Then 'no debe considerar cuando es pedido de contrato
If CveVendedor > 0 AndAlso (UsuarioActual.Empresa.Funcionalidad(146) = "1" Or CveCliente > 0) Then 'no debe considerar cuando es pedido de contrato
If TipoMovimiento = 1 Then ' SI ES DEVOLUCION NO APLICA APARTADO
' SALIDA POR TRASPASO DE LOS ALMACENES DE APARTADO
For Each Dr As DataRow In DtDatos.Rows

View File

@@ -945,10 +945,12 @@ Partial Class Inventarios_ResguardoMaterial
Dim Fecha As DateTime = TxtFechaVigencia.Text.Trim().ToDateTime()
Dim FechaI As DateTime = Fecha
Dim FechaF As DateTime = Fecha.AddHours(22)
TieneError = Not ObjEventos.AddEventoAgenda(CveAgendaTipo, Asunto, Descripcion, Prioridad, FechaI, FechaF, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
If Fecha > MinFecha Then
TieneError = Not ObjEventos.AddEventoAgenda(CveAgendaTipo, Asunto, Descripcion, Prioridad, FechaI, FechaF, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa,
RecurrenciaTipo:=RecurrenciaTipo, Frecuencia:=Frecuencia, DiasSemana:=DiasSemana, Dia:=Dias, Mes:=Mes, RecurrenciaFin:=RecurrenciaFin, CveTipoEvento:=CveTipoEvento, Importe:=Importe)
End If
Return Not TieneError
End Function

View File

@@ -2240,7 +2240,7 @@ Partial Class OC
End If
'Valida que tenga proveedore
If (EsNuevo = True AndAlso TipoOC.ToUpper = "OC"4) AndAlso DdlProveedores.SelectedValue.ToEntero() <= 0 Then
If (EsNuevo = True AndAlso TipoOC.ToUpper = "OC") AndAlso DdlProveedores.SelectedValue.ToEntero() <= 0 Then
Alert("Debe seleccionar un proveedor.", TipoMensaje.MsgAdvertencia)
TieneError = True
End If
@@ -6980,21 +6980,23 @@ Partial Class OC
TxtRetIVA.Text = TxtRetIVA.Text.FormatoNumero
HdnRetIVA.Value = TxtRetIVA.Text
Dim Porcentaje = TxtRetIVA.Text.ToDecimal / DtDetalle.SUM("Total")
Dim Porcentaje As Decimal = TxtRetIVA.Text.ToDecimal / DtDetalle.SUM("Total")
Dim LastDr As DataRow = Nothing
For Each Dr As DataRow In DtDetalle.Rows
Dr("RetIVA") = (Math.Truncate((Dr("Total").ToString.ToDecimal * Porcentaje) * 100)) / 100
'Dr("RetIVA") = (Math.Truncate((Dr("Total").ToString.ToDecimal * Porcentaje) * 100)) / 100
Dr("RetIVA") = Math.Round((Dr("Total").ToString.ToDecimal * Porcentaje), 2)
'Dr("RetIVA") = Math.Round((Dr("Cantidad").ToString.ToDecimal * Dr("Importe").ToString.ToDecimal * Porcentaje), 2)
Dr("RetIVAPorcentaje") = Porcentaje
' Tipo Dato '0' es Cuando es Nuevo, '1' para editar y '2' viene de la BD
Dr("TipoDato") = If(Dr("TipoDato").ToString.ToEntero = 0, 0, 1)
LastDr = Dr
Next
If Not IsNothing(LastDr) Then
Dim Fdes As Decimal = TxtRetIVA.Text.ToDecimal - DtDetalle.SUM("RetIVA").ToString.ToDecimal
If Fdes > 0 Then
LastDr("RetIVA") = LastDr("RetIVA").ToString.ToDecimal + Fdes
End If
End If
'If Not IsNothing(LastDr) Then
' Dim Fdes As Decimal = TxtRetIVA.Text.ToDecimal - DtDetalle.SUM("RetIVA").ToString.ToDecimal
' If Fdes > 0 Then
' LastDr("RetIVA") = LastDr("RetIVA").ToString.ToDecimal + Fdes
' End If
'End If
'Alert(String.Format("Descuento:{0}", DtDetalle.SUM("Descuento")))

View File

@@ -838,20 +838,20 @@
</div>
<div id="DivRetenciones" runat="server">
<div id="DivTipoRetenciones" runat="server" visible="false" class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoRetencion" CssClass="form-control select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="MetodoPago" DataValueField="CveMetodoPago" ValidationGroup="GrpGuardar">
<asp:DropDownList ID="DdlTipoRetencion" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoRetencion_SelectedIndexChanged" CssClass="form-control select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true">
<asp:ListItem Selected="True" Text="Sin Retención" Value="0"></asp:ListItem>
<asp:ListItem Text="Arrendamiento" Value="1"></asp:ListItem>
<asp:ListItem Text="Servicios Profesionales" Value="2"></asp:ListItem>
<asp:ListItem Text="Fletes" Value="3"></asp:ListItem>
<asp:ListItem Text="Servicios" Value="4"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoRetencion.ClientID.ToString()%>">Tipo de Retención:</label>
<label for="<%= DdlTipoRetencion.ClientID.ToString()%>">Tipo de Retención de IVA:</label>
<asp:RequiredFieldValidator ID="RFVTipoRetencion" runat="server" ControlToValidate="DdlTipoRetencion" CssClass="help-block" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo de Retención''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<i></i>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<div id="DivRetIVA" runat="server" class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtRetIVA" CssClass="form-control" runat="server" MaxLength="9" Text="0"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVRetIVA" class="help-block errorimput" runat="server" ControlToValidate="TxtRetIVA" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Retención de IVA''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVRetIVA" class="help-block errorimput" runat="server" ControlToValidate="TxtRetIVA" ErrorMessage="El campo <b>''Retención de IVA''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Double" ValidationGroup="GrpGuardar"></asp:CompareValidator>

View File

@@ -717,9 +717,13 @@ Partial Class Clientes
If UsuarioActual.TienePermisoProceso(180) Then
ChkEstado.Enabled = True
End If
End If
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
DivTipoRetenciones.Visible = True
DivRetIVA.Visible = False
End If
If Request("CveCliente") IsNot Nothing AndAlso IsNumeric(Request("CveCliente")) AndAlso Request("CveCliente").ToEntero > 0 Then
'If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not Request("CveCliente").Contiene("10450", "10460", "10458") Then
' BtnGuardar.Enabled = False : BtnEliminar.Enabled = False : LbAgregarSucursal.Enabled = False : LbEnviarActivacionPortal.Enabled = False
@@ -820,10 +824,6 @@ Partial Class Clientes
UpFiscalContable.Update()
End If
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
DivTipoRetenciones.Visible = True
End If
If Request("CveEmpresaCRM") IsNot Nothing AndAlso IsNumeric(Request("CveEmpresaCRM")) AndAlso Request("CveEmpresaCRM").ToEntero > 0 Then
ViewState("CveEmpresaCRM") = Request("CveEmpresaCRM")
CargaDatosCRM()
@@ -1380,6 +1380,7 @@ Partial Class Clientes
TxtCC.Text = ObjClientes.NotificarA
ChkMail.Checked = ObjClientes.EnviarFactura
DdlTipoRetencion.SelectedValueExist(ObjClientes.DtResultados(0)("CveTipoRetencion").ToString)
DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty)
TxtRetIVA.Text = ObjClientes.RetIVA.ToString
TxtRetISR.Text = ObjClientes.RetISR.ToString
ChkRetIVAFletesAcarreos.Checked = ObjClientes.RetieneIVAFletes
@@ -9941,5 +9942,23 @@ Partial Class Clientes
End Sub
#End Region
Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs)
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
TxtRetIVA.Text = "0"
DivRetIVA.Visible = False
If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
TxtRetIVA.Text = "10"
DivRetIVA.Visible = True
ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
TxtRetIVA.Text = "4"
DivRetIVA.Visible = True
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") Then
TxtRetIVA.Text = "6"
DivRetIVA.Visible = True
End If
End If
End Sub
End Class

View File

@@ -568,7 +568,10 @@
<label for="<%= DdlIEPSPorcentaje.ClientID.ToString()%>">IEPS Porcentaje:</label>
</div>
<div class="form-group form-md-line-input input-iconright">
<label>Es OutSourcing </label>
<asp:CheckBox ID="ChkEsOutSourcing" CssClass="make-switchsd" data-size="small" runat="server" Checked="False" />
</div>
</div>
</div>
</div>

View File

@@ -866,7 +866,7 @@ Partial Class ProductosyServicios
CargaCaracteristicas()
LnkUnificar.Visible = True
ChkEsOutSourcing.Checked = ObjProductosServicios.EsOutSourcing
Else
Alert("El Producto o Servicio Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
RegistraScript("$('#C_Tab_TabPaquetes_tab').css('display' , 'none')")
@@ -1163,7 +1163,7 @@ Partial Class ProductosyServicios
CveClasificacionDetalle:=DdlTipoPSDes.SelectedValue.ToEntero, CveTamaño:=DdlTamanio.SelectedValue.ToEntero,
CveModelo:=DdlModelo.SelectedValue.ToEntero(), CveMedida:=DdlMedida.SelectedValue.ToEntero(), CveRinTamaño:=DdlRin.SelectedValue.ToEntero(),
ClaveImpuestoEmpaque:=DdlImpEmpaque.SelectedValue.ToString, ClaveImpuestoUM:=DdlImpUM.SelectedValue.ToString, ClaveCategoriaToxicidad:=DdlCategoriaToxicidad.SelectedValue.ToString,
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString) > 0 Then
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked) > 0 Then
ViewState("CvePS") = ObjProductosServicios.CvePS
For Each GVR As GridViewRow In GvImpuestosLocales.Rows
If GVR.FCCheckBox("ChkDeduccion").Checked Then
@@ -1208,7 +1208,7 @@ Partial Class ProductosyServicios
CveUsuarioModifico:=UsuarioActual.CveUsuario, CveClasificacionDetalle:=DdlTipoPSDes.SelectedValue.ToEntero, CveTamaño:=DdlTamanio.SelectedValue.ToEntero,
CveModelo:=DdlModelo.SelectedValue.ToEntero(), CveMedida:=DdlMedida.SelectedValue.ToEntero(), CveRinTamaño:=DdlRin.SelectedValue.ToEntero(),
ClaveImpuestoEmpaque:=DdlImpEmpaque.SelectedValue.ToString, ClaveImpuestoUM:=DdlImpUM.SelectedValue.ToString, ClaveCategoriaToxicidad:=DdlCategoriaToxicidad.SelectedValue.ToString,
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString) Then
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked) Then
If Not ObjProductosServicios.LimpiaImpuestosLocales(CvePS) Then
TieneError = True

File diff suppressed because it is too large Load Diff

View File

@@ -4294,6 +4294,8 @@ Partial Class Ventas
End If
End If
CargaCodigoUnico()
UpPS.Update()
UpContado.Update()
UpEstatus.Update()
@@ -4699,6 +4701,7 @@ Partial Class Ventas
LblTelefono.Text = ObjCliente.Telefono
LblRetIVA.Text = ObjCliente.RetIVA.ToString.FormatoNumero(5)
LblRetISR.Text = ObjCliente.RetISR.ToString.FormatoNumero(5)
If UsuarioActual.Empresa.MostrarRetISR AndAlso ObjCliente.RetISR > 0 Then TrRetISR.Style.Add("display", "none")
ViewState("ClienteRetIVA") = ObjCliente.RetIVA / 100
ViewState("ClienteRetISR") = ObjCliente.RetISR / 100
@@ -5015,6 +5018,8 @@ Partial Class Ventas
TrVistaPrevia.Visible = True
TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString
If Not (ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Rem") Then
CargaRestriccionesCreditoCliente(True, Me.CveVenta)
End If
@@ -5928,11 +5933,12 @@ Partial Class Ventas
Dim ClienteRetIVA = Me.ClienteRetIVA
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
ClienteRetIVA = 0.0D
If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
ClienteRetIVA = 0.1D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
ClienteRetIVA = 0.04D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") Then
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(TmpDT.Rows(e.RowIndex)("EsOutSourcing").ToString()) Then
ClienteRetIVA = 0.06D
End If
@@ -10307,7 +10313,7 @@ Partial Class Ventas
'Nota cuando es Nota de crédiot, debe de tomar el devoluciones y rebajas
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
Dim CampoCuenta As String = "IdCuentaGasto"
If UsuarioActual.CveEmpresa.Contiene(80, 72, 146) Then CampoCuenta = "IdCuentaDescuento"
'If UsuarioActual.CveEmpresa.Contiene(80, 72, 146) Then CampoCuenta = "IdCuentaDescuento"
IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor(CampoCuenta, String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero
Else
IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero
@@ -14247,11 +14253,12 @@ Partial Class Ventas
Dim ClienteRetIVA = Me.ClienteRetIVA
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
ClienteRetIVA = 0.0D
If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
ClienteRetIVA = 0.1D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
ClienteRetIVA = 0.04D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso DrPS("CveTipoPS").ToString().ToEntero() = 1 Then
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(DrPS("EsOutSourcing").ToString()) Then
ClienteRetIVA = 0.06D
End If
@@ -14502,6 +14509,8 @@ Partial Class Ventas
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
TmpDT.Columns.Add("CveConcepto", GetType(Integer))
TmpDT.Columns.Add("EsOutSourcing", GetType(Boolean))
End Sub
Private Sub CreaDTmpC()
DTmpC = New DataTable
@@ -16362,181 +16371,186 @@ Partial Class Ventas
Private Sub BtnEditarRemision_Click(sender As Object, e As EventArgs) Handles BtnEditarRemision.Click
Dim OcurrioError As Boolean = False
Dim ObjVentas As New ClsVentas
ObjVentas.IniciaTransacSQL()
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL())
Dim ObjAC As ClsContPAQi = Nothing
Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero
Dim TipoCambio As Double = TxtTipoCambio.Text.ToDouble
EditoRemision = True
'Dim SubTotal, Descuento, IVA, RetIVA, RetISR, IEPS, Total As Decimal
ObjVentas.IniciaTransacSQL()
Try
'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS
If DdlMoneda.SelectedValue.ToEntero <> 2 AndAlso ChkConvertirDolares.Checked Then
For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6)
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Next
'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS
If DdlMoneda.SelectedValue.ToEntero <> 2 AndAlso ChkConvertirDolares.Checked Then
For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6)
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
Next
Dim ImpuestosLocales As Double = 0
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal).FormatoNumero
ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
End If
Next
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
TipoCambio = TxtTipoCambioDlls.Text.Trim.ToDecimal
Moneda = 2
End If
'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES
If DdlMoneda.SelectedValue.ToEntero <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then
Dim Importe As Decimal
Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal
For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * TCC, 6)
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal * TCC, NumeroDecimales)
Importe = Row("Total").ToString.ToDecimal - Row("Descuento").ToString.ToDecimal
Row("ImporteIEPS") = Math.Round(Importe * Row("PorcentajeIEPS").ToString.ToDecimal, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Importe * Row("PorcentajeIVA").ToString.ToDecimal, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Importe * Row("PorcentajeRetIVA").ToString.ToDecimal, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Importe * Row("PorcentajeRetISR").ToString.ToDecimal, NumeroDecimales)
Next
Dim ImpuestosLocales As Double = 0
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal).FormatoNumero
ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales)
End If
Next
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
TipoCambio = 1
Moneda = 1
End If
'Actualizo los parametros de la venta
If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.ToDecimal, LblDescuentos.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtIEPS.Text.ToDecimal, TxtTotal.Text.ToDecimal, Moneda, TipoCambio, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim,
UsuarioActual.CveEmpresa, CveVenta, 0, 0,
Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1),
PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero,
CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, TipoDocto:="Rem", CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal,
OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, Kilometraje:=TxtKilometraje.Text.ToDouble) Then
OcurrioError = True
End If
'Cargo de nueva cuenta el detalle de Ventas (Conceptos)
If Not OcurrioError Then
Dim index As Integer = 0
For Each Row As DataRow In TmpDT.Rows
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero()
If CveVentaDetalle > 0 Then
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
Dim ImpuestosLocales As Double = 0
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal).FormatoNumero
ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
End If
Else
If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero,
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
OcurrioError = True
Exit For
Next
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
TipoCambio = TxtTipoCambioDlls.Text.Trim.ToDecimal
Moneda = 2
End If
'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES
If DdlMoneda.SelectedValue.ToEntero <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then
Dim Importe As Decimal
Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal
For Each Row As DataRow In TmpDT.Rows
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * TCC, 6)
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal * TCC, NumeroDecimales)
Importe = Row("Total").ToString.ToDecimal - Row("Descuento").ToString.ToDecimal
Row("ImporteIEPS") = Math.Round(Importe * Row("PorcentajeIEPS").ToString.ToDecimal, NumeroDecimales)
Row("ImporteIVA") = Math.Round(Importe * Row("PorcentajeIVA").ToString.ToDecimal, NumeroDecimales)
Row("ImporteRetIVA") = Math.Round(Importe * Row("PorcentajeRetIVA").ToString.ToDecimal, NumeroDecimales)
Row("ImporteRetISR") = Math.Round(Importe * Row("PorcentajeRetISR").ToString.ToDecimal, NumeroDecimales)
Next
Dim ImpuestosLocales As Double = 0
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal).FormatoNumero
ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales)
End If
Next
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
TipoCambio = 1
Moneda = 1
End If
'Actualizo los parametros de la venta
If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.ToDecimal, LblDescuentos.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtIEPS.Text.ToDecimal, TxtTotal.Text.ToDecimal, Moneda, TipoCambio, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim,
UsuarioActual.CveEmpresa, CveVenta, 0, 0,
Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1),
PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero,
CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, TipoDocto:="Rem", CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal,
OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, Kilometraje:=TxtKilometraje.Text.ToDouble) Then
OcurrioError = True
End If
'Cargo de nueva cuenta el detalle de Ventas (Conceptos)
If Not OcurrioError Then
Dim index As Integer = 0
For Each Row As DataRow In TmpDT.Rows
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero()
If CveVentaDetalle > 0 Then
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
End If
Else
TmpDT.Rows(index)("CveVentaDetalle") = ObjVentas.CveVentaDetalle
If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero,
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
OcurrioError = True
Exit For
Else
TmpDT.Rows(index)("CveVentaDetalle") = ObjVentas.CveVentaDetalle
End If
End If
End If
index = index + 1
Next
End If
index = index + 1
Next
End If
'ELIMINA LOS DETALLES
If Not OcurrioError Then
Dim DtEliminados As New DataTable
If ObjVentas.GetVentaDetalle(CveVenta) Then
DtEliminados = ObjVentas.DtResultados.FiltraParametros("", "", {"CveVentaDetalle"})
For Each Dr1 As DataRow In DtEliminados.Rows
If TmpDT.FiltraParametros($"CveVentaDetalle = {Dr1("CveVentaDetalle")}").Rows.Count = 0 Then
If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then
'ELIMINA LOS DETALLES
If Not OcurrioError Then
Dim DtEliminados As New DataTable
If ObjVentas.GetVentaDetalle(CveVenta) Then
DtEliminados = ObjVentas.DtResultados.FiltraParametros("", "", {"CveVentaDetalle"})
For Each Dr1 As DataRow In DtEliminados.Rows
If TmpDT.FiltraParametros($"CveVentaDetalle = {Dr1("CveVentaDetalle")}").Rows.Count = 0 Then
If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then
OcurrioError = True
End If
End If
Next
Else
OcurrioError = True
End If
End If
'OcurrioError = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, 1, ObjBancos, ObjVentas)
'Actualizo impuestos locales
If Not OcurrioError Then
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString.ToEntero, gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal) Then
OcurrioError = True
End If
End If
Next
Else
OcurrioError = True
End If
End If
'OcurrioError = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, 1, ObjBancos, ObjVentas)
'Actualizo impuestos locales
If Not OcurrioError Then
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString.ToEntero, gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal) Then
OcurrioError = True
End If
End If
Next
End If
'Orden Produccion'
If Not OcurrioError Then
If UsuarioActual.CveEmpresa.Contiene(126) Then
If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero > 0 Then
If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then
OcurrioError = True
'Orden Produccion'
If Not OcurrioError Then
If UsuarioActual.CveEmpresa.Contiene(126) Then
If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero > 0 Then
If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then
OcurrioError = True
End If
End If
End If
End If
End If
If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
If ObjConta.ValorPolizaDescuadre = 2 Then
If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
If ObjConta.ValorPolizaDescuadre = 2 Then
OcurrioError = True
Alert(ObjConta.MensajePolizaDescuadre, TipoMensaje.MsgError)
End If
End If
End If
If Not OcurrioError Then
If RegeneracionPolizas(ObjVentas, ObjAC, ObjConta, ObjBancos) Then
OcurrioError = True
Alert(ObjConta.MensajePolizaDescuadre, TipoMensaje.MsgError)
End If
End If
End If
If Not OcurrioError Then
If RegeneracionPolizas(ObjVentas, ObjAC) Then
OcurrioError = True
End If
End If
Catch ex As Exception
OcurrioError = True
OnError("Ocurrió un error al actualizar la remisión", ex)
End Try
If OcurrioError Then
ObjVentas.RollBack()
@@ -17342,19 +17356,22 @@ Partial Class Ventas
End Sub
Private Sub BtnAgregarCliente_Click(sender As Object, e As EventArgs) Handles BtnAgregarCliente.Click
Dim CvePreioLista As Integer = -1
Dim CvePrecioLista As Integer = -1
If DdlSubProyectoDatos.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows(0)
If Dr IsNot Nothing Then
If Dr("CvePrecioLista").ToString.ToEntero > 0 Then
CvePreioLista = Dr("CvePrecioLista").ToString.ToEntero
CvePrecioLista = Dr("CvePrecioLista").ToString.ToEntero
End If
End If
End If
Dim ObjCliente As New ClsClientes
If ObjCliente.AgregarClienteNoFrecuente(TxtNombreCliente.Text.Trim, TxtDireccionCliente.Text.Trim, TxtNumExtCliente.Text.Trim, TxtNumIntCliente.Text.Trim, TxtColoniaCliente.Text.Trim, TxtLocalidadCliente.Text.Trim, TxtCiudadCliente.Text.Trim, TxtEstadoCliente.Text.Trim, TxtPaisCliente.Text.Trim, TxtRFCCliente.Text.Trim, TxtCPCliente.Text.Trim, TxtTelefonoCliente.Text.Trim, TxtCorreoCliente.Text.Trim, DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", CvePreioLista) Then
If ObjCliente.AgregarClienteNoFrecuente(TxtNombreCliente.Text.Trim, TxtDireccionCliente.Text.Trim, TxtNumExtCliente.Text.Trim, TxtNumIntCliente.Text.Trim,
TxtColoniaCliente.Text.Trim, TxtLocalidadCliente.Text.Trim, TxtCiudadCliente.Text.Trim, TxtEstadoCliente.Text.Trim,
TxtPaisCliente.Text.Trim, TxtRFCCliente.Text.Trim, TxtCPCliente.Text.Trim, TxtTelefonoCliente.Text.Trim, TxtCorreoCliente.Text.Trim,
DdlSubProyectoDatos.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, CvePrecioLista:=CvePrecioLista) Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
RegistraScript("hideDivEC();")
ViewState("CveCliente") = ObjCliente.DtResultados(0)("CveCliente").ToString.ToEntero
@@ -17446,34 +17463,26 @@ Partial Class Ventas
End Sub
Private Function RegeneracionPolizas(ByRef ObjVentas As ClsVentas, ByRef ObjAC As ClsContPAQi) As Boolean
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
Dim CvePlantillaPoliza As Integer
Private Function RegeneracionPolizas(ByRef ObjVentas As ClsVentas, ByRef ObjAC As ClsContPAQi, ByRef ObjConta As ClsContabilidad, ObjBancos As ClsBancos) As Boolean
Dim ErrorCancelar As Boolean = False
Dim Mensaje As String = ""
CreaObjetosVenta()
If UsuarioActual.Empresa.UsaAC Then
ObjAC = New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
End If
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
CvePlantillaPoliza = 7
ElseIf ObjFactura.TipoDocto.Contiene("Ing", "Rem", "Ant") Then
CvePlantillaPoliza = 4
Else
CvePlantillaPoliza = 4
End If
'Removemos los conceptos de la prepoliza
ObjConta.RemovePrePolizasDetalle(CvePrePoliza, -1, CveVenta, 2)
'REMOVEMOS LOS CONCEPTOS DE LA PREPOLIZA
ErrorCancelar = Not ObjConta.RemovePrePolizasDetalle(CvePrePoliza, -1, CveVenta, 2)
ObjFactura.CveVenta = CveVenta
ObjFactura.CvePrePoliza = CvePrePoliza
ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, 1, ObjBancos, ObjVentas)
'VUELVE A GENERAR LAS PREPOLIZAS
If Not ErrorCancelar Then ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, 1, ObjBancos, ObjVentas)
If Not ErrorCancelar Then ErrorCancelar = GuardarVentaImpuestosLocales(ObjVentas, ObjConta, ObjFactura, 1)
Return ErrorCancelar
@@ -23901,54 +23910,61 @@ Partial Class Ventas
End Sub
#Region "P O L I Z A - V I R T U A L"
Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura)
Dim DtUsados As DataTable = Nothing
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasPolizaVirtual(ObjFactura.CveVenta) Then
DtUsados = ObjAcum.DtResultados.Copy()
Private Sub CargaCodigoUnico()
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasPolizaVirtual(Me.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then
GvCodigosUnicos.DataSource = ObjAcum.DtResultados
DivCodigosUnicos.Visible = True
End If
ObjAcum.Dispose()
GvCodigosUnicos.DataBind()
End If
ObjAcum.Dispose()
End Sub
Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura)
Try
For Each Row As DataRow In DtUsados.Rows
Dim obj As New Modelos.MPolizaVentaWS
'DATOS DEL CLIENTE
obj.customer_name = ObjFactura.Cliente.Nombre
obj.customer_last_name1 = ""
obj.customer_last_name2 = ""
obj.customer_birthday = Nothing
obj.customer_phone = ObjFactura.Cliente.Telefono
obj.customer_email = ObjFactura.Cliente.Mail
obj.customer_gender = "03" 'OTRO GENERO
obj.customer_advertising = False
obj.customer_car_brand = "00"
obj.customer_car_model = "00"
obj.customer_car_year = ObjFactura.Fecha.Year
For Each Row As GridViewRow In GvCodigosUnicos.Rows
If Row.RowType = DataControlRowType.DataRow Then
Dim obj As New Modelos.MPolizaVentaWS
'DATOS DEL CLIENTE
obj.customer_name = ObjFactura.Cliente.Nombre
obj.customer_last_name1 = ""
obj.customer_last_name2 = ""
obj.customer_birthday = Nothing
obj.customer_phone = ObjFactura.Cliente.Telefono
obj.customer_email = ObjFactura.Cliente.Mail
obj.customer_gender = "03" 'OTRO GENERO
obj.customer_advertising = False
obj.customer_car_brand = "00"
obj.customer_car_model = "00"
obj.customer_car_year = ObjFactura.Fecha.Year
'DATOS DE VENTA
obj.sale_date = ObjFactura.Fecha
obj.sale_paidby = "01"
obj.sale_type = "01" 'PISO
obj.sale_type_service = "02" 'COMERCIAL
obj.sale_total = ObjFactura.Total
obj.sale_discount = ObjFactura.Descuento
obj.sale_id = String.Format("{0}{1}{2}", ObjFactura.Serie, ObjFactura.Folio, ObjFactura.CveVenta)
'DATOS DE VENTA
obj.sale_date = ObjFactura.Fecha
obj.sale_paidby = "01"
obj.sale_type = "01" 'PISO
obj.sale_type_service = "02" 'COMERCIAL
obj.sale_total = ObjFactura.Total
obj.sale_discount = ObjFactura.Descuento
obj.sale_id = String.Format("{0}{1}{2}", ObjFactura.Serie, ObjFactura.Folio, ObjFactura.CveVenta)
'DATOS DEL PRODUCTO
obj.product_code = Row("IdProductoPolizaVirtual").ToString()
obj.product_unique_code = Row("SerieLote").ToString() 'se indique el código único de la batería. (SERIE LOTE)
obj.product_sale_type = "01 " 'VENTA
'DATOS DEL PRODUCTO
obj.product_code = Row.DataKey("IdProductoPolizaVirtual").ToString()
obj.product_unique_code = Row.FCTextBox("TxtCodigoUnico").Text 'se indique el código único de la batería. (SERIE LOTE)
obj.product_sale_type = "01 " 'VENTA
Dim FechaUsado As DateTime = Row("FechaAjuste").ToString().ToDateTime()
Dim FechaUsado As DateTime = Row.DataKey("FechaAjuste").ToString().ToDateTime()
'DATOS DE USADO
obj.used_product = True
obj.used_brand = Row("IdModelo").ToString() 'MARCAR DEL USADO
obj.used_bci = Row("CveBCIUsado").ToString() 'VALOR DEL BCI
obj.used_month = FechaUsado.Month
obj.used_year = FechaUsado.Year
obj.used_sale_date = FechaUsado
'DATOS DE USADO
obj.used_product = True
obj.used_brand = Row.DataKey("IdModelo").ToString() 'MARCAR DEL USADO
obj.used_bci = Row.DataKey("IdBCI").ToString() 'VALOR DEL BCI
obj.used_month = FechaUsado.Month
obj.used_year = FechaUsado.Year
obj.used_sale_date = FechaUsado
EnviarPolizaVentaWS(obj)
EnviarPolizaVentaWS(obj)
End If
Next
Catch ex As Exception
OnError("Ocurrió un error al generar la poliza virtual", ex)
@@ -24034,12 +24050,12 @@ Partial Class Ventas
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
For Each RowServicio As DataRow In TmpDT.Rows
Dim ClienteRetIVA = Me.ClienteRetIVA
Dim ClienteRetIVA = 0.0D
If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
ClienteRetIVA = 0.1D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
ClienteRetIVA = 0.04D
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso RowServicio("CveTipoPS").ToString().ToEntero() = 1 Then
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(RowServicio("EsOutSourcing").ToString()) Then
ClienteRetIVA = 0.06D
End If