This commit is contained in:
caudillochon
2025-02-14 09:13:52 -07:00
9 changed files with 1299 additions and 76 deletions

View File

@@ -6426,6 +6426,26 @@ Public Class ClsInventarios
Return Retorno
End Function
Public Function GetVentasRemisionesInventario(Ventas As String, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_VentasRemisionesInventarioGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@Ventas", SqlDbType.VarChar).Value = Ventas
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el inventario de las remisiones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#Region " IDisposable Support "
' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)

View File

@@ -7742,6 +7742,8 @@ Public Class ClsPaginas
'Dim urlHost As String = "http://localhost:2202/"
If EsProduccion Then
urlHost = "http://192.200.113.178:6599/"
Else
urlHost = "http://localhost:2202/"
End If
'SITIO DE PRUEBA EN IIS
Dim Url As Uri = New Uri(String.Format("{0}{1}", urlHost, Opcion))

View File

@@ -3548,32 +3548,35 @@ Namespace Modelos
If Not ErrorPrepoliza AndAlso ObjFactura.CveTipoAmortizacionAnticipo = 2 AndAlso ObjFactura.EsNCAmortizacion AndAlso ObjFactura.TipoDocto.Contiene("Egs") AndAlso ObjFactura.DtAnticiposAplicados IsNot Nothing Then
For Each row2 As DataRow In ObjFactura.DtAnticiposAplicados.Rows
If row2("CveConceptoContable").ToString().ToEntero() = 3 Then
CveIEAnticipo = row2("CveIE").ToString().ToEntero()
For Each RowAnticipo As DataRow In ObjFactura.DtAnticiposAplicados.Rows
If RowAnticipo("Tipo").ToString() = "Ant" AndAlso RowAnticipo("CveConceptoContable").ToString().ToEntero().Contiene(3, 295) Then
importeMovimiento = row2("Importe").ToString().ToDecimal() '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
importeMovimiento = RowAnticipo("Importe").ToString().ToDecimal()
Dim ImporteAnticipo As Decimal = importeMovimiento
Dim CveMonedaAnticipo As Integer = row2("CveMoneda").ToString().ToEntero()
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
Dim CveMonedaAnticipo As Integer = RowAnticipo("CveMoneda").ToString().ToEntero()
If ObjFactura.CveTipoAmortizacionAnticipo = 2 Then
Dim DescuentosAnticipos As Decimal = row2("Descuentos").ToString().ToDecimal
ImporteAnticipo = ImporteAnticipo / (row2("TotalAnticipo").ToString().ToDecimal - DescuentosAnticipos) * row2("SubTotalAnticipo").ToString().ToDecimal
Dim DescuentosAnticipos As Decimal = RowAnticipo("Descuentos").ToString().ToDecimal
ImporteAnticipo = ImporteAnticipo / (RowAnticipo("TotalAnticipo").ToString().ToDecimal - DescuentosAnticipos) * RowAnticipo("SubTotalAnticipo").ToString().ToDecimal
ImporteAnticipo = ImporteAnticipo.RoundSQL(2)
End If
Dim Importe11MX As Decimal = ImporteAnticipo
CveSubProyectoContabilizar = CveSubProyectoVenta
Dim PagoAnt As New ClsPaginas.VentaPago
PagoAnt.ImportePagoVenta = 0 'DEBE SER 0 PORQUE EL PAGO A LA FACTURA YA FUE APLICADO PREVIAMENTE
PagoAnt.ImportePago = ImporteAnticipo
PagoAnt.CveIE = RowAnticipo("CveIE").ToString().ToEntero()
PagoAnt.CveMonedaPago = CveMonedaAnticipo
PagoAnt.TipoPago = "A"
PagoAnt.Fecha = ObjFactura.Fecha
PagoAnt.CveVentaAmortizacion = RowAnticipo("CveVenta").ToString().ToEntero()
PagoAnt.TCPago = RowAnticipo("TipoCambioPago").ToString().ToDecimal()
PagoAnt.AplicaTraslado = False
PagoAnt.Referencia = Referencia
PagoAnt.AplicaConceptoImpuestoPendiente = False
ErrorPrepoliza = ClsPaginas.AplicaPrePolizaPagoVenta(ventaRef, PagoAnt, ObjFactura.CvePrePoliza, ObjConta)
If importeMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, Importe11MX, Importe11MX, 11, Referencia, Concepto, CveVenta:=row2("CveVenta").ToString().ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then
ErrorPrepoliza = True
Exit For
End If
End If
End If
Next
@@ -4518,7 +4521,7 @@ Namespace Modelos
Private Function GuardarVentaInventarios(ByRef Resp As MMensajeFactura, ByRef factura As Modelos.Factura, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, ObjVentas As ClsVentas, ObjAcum As ClsAcumuladores) As Boolean
Dim OcurrioError As Boolean = False
If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then
If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
If factura.GenerarSalidaAlmacen AndAlso factura.CveAlmacen > 0 AndAlso DtInventario.Rows.Count > 0 Then
Dim CveMovimientoInventario As Integer = GenerarMovimientoAlmacenServicioDomicilio(ObjInventario, factura, factura.DtInventario, factura.CveAlmacen, 3, factura.CveMoneda, factura.CveVenta, "Modelos/SA", MovimientoPrePoliza:=True, ObjConta:=ObjConta)
@@ -4546,13 +4549,38 @@ Namespace Modelos
'End If
If RemisionesLista IsNot Nothing AndAlso factura.TipoDocto = "Ing" AndAlso RemisionesLista.Count > 0 Then
For Each CveRemision As Integer In RemisionesLista
'El almacen general es el Primer Almacen de Material en la Sucursal
If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9, factura.EsFacturaGlobal) Then
OcurrioError = True
Exit For
If factura.EsFacturaGlobal Then
Dim DtMovimientosRemisiones As DataTable = Nothing
Dim SbRemisiones As New StringBuilder()
For Each CveRem In RemisionesLista
SbRemisiones.AppendFormat("{0},", CveRem)
Next
SbRemisiones.Remove(SbRemisiones.Length - 1, 1)
If ObjInventario.GetVentasRemisionesInventario(SbRemisiones.ToString(), UsuarioActual.CveEmpresa) Then
DtMovimientosRemisiones = ObjInventario.DtResultados.Copy()
End If
Next
If DtMovimientosRemisiones IsNot Nothing Then
If Not TraspasoAlmacenFacturaGlobal(DtMovimientosRemisiones, ObjInventario, ObjConta) Then
OcurrioError = True
End If
End If
Else
For Each CveRemision As Integer In RemisionesLista
'El almacen general es el Primer Almacen de Material en la Sucursal
If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9, factura.EsFacturaGlobal) Then
OcurrioError = True
Exit For
End If
Next
End If
End If
If factura.TipoDocto = "Rem" AndAlso factura.ServicioDomicilio Then
@@ -4905,6 +4933,37 @@ Namespace Modelos
End Try
Return Not OcurrioError
End Function
Private Function TraspasoAlmacenFacturaGlobal(DtMovimientosRemisiones As DataTable, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad) As Boolean
Dim OcurrioError As Boolean = False
Try
Dim DtMovimientos As DataTable = DtMovimientosRemisiones.FiltraParametros("", DistinctColumns:={"CveMovimiento", "CveAlmacen"})
For Each RowMovto As DataRow In DtMovimientos.Rows
Dim CveAlmacenParaSalida As Integer = RowMovto("CveAlmacen").ToString().ToEntero()
Dim CveConceptoSalidaAlmacen As Integer = 40
Dim MovDetalle As DataTable = DtMovimientosRemisiones.FiltraParametros($"CveMovimiento = {RowMovto("CveMovimiento")}")
Dim CveMovimientoSalidaAlmacen As Integer = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenParaSalida, CveConceptoSalidaAlmacen, Me.CveMoneda, Me.CveVenta, AplicaMovimientoDetalleEntrada:=True, MovimientoPrePoliza:=True, ObjConta:=ObjConta)
Dim GeneroMovimientoAlmacen = CveMovimientoSalidaAlmacen > 0
If Not GeneroMovimientoAlmacen Then
OcurrioError = True
Exit For
End If
Next
Catch ex As Exception
OcurrioError = True
OnError("Ocurrió un error al realizar el traspaso", ex)
End Try
Return Not OcurrioError
End Function
Private Function GenerarMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, DtMovDetalle As DataTable, CveAlmacen As Integer, ConceptoEntrada As Integer, CveMoneda As Integer, CveVenta As Integer, Optional MovimientoPrePoliza As Boolean = True,
Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1, Optional AplicaMovimientoDetalleEntrada As Boolean = False,
Optional CveAlmacenDestino As Integer = -1) As Integer

View File

@@ -265,10 +265,10 @@
<div class="col-md-4">
<asp:RadioButtonList ID="RBLContado" runat="server" RepeatDirection="Horizontal" Style="margin: auto" AutoPostBack="True" RepeatColumns="3">
<asp:ListItem Value="6" Selected="True" >Caja Chica</asp:ListItem>
<asp:ListItem Value="2">Viáticos</asp:ListItem>
<asp:ListItem Value="2">Viáticos</asp:ListItem>
<asp:ListItem Value="4">Deudores</asp:ListItem>
</asp:RadioButtonList>
</div>
@@ -295,7 +295,7 @@
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright" style="padding-top:14px">
<ADS:Dropdownlost runat="server" ID="DdlPS" CssStyle="width:100%" CssClass="form-control input-sm DdlPS" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS" Width="100%" />
<ADS:Dropdownlost runat="server" ID="DdlPS" CssStyle="width:100%" CssClass="form-control input-sm DdlPS" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS" Width="100%" />
<label for="<%= DdlPS.ClientID.ToString()%>">
Productos / Servicio:<label>
</div>
@@ -334,6 +334,7 @@
</asp:RequiredFieldValidator>
</div>
<asp:LinkButton runat="server" ID="LnlMostarProrateo" OnClick="LnlMostarProrateo_Click" CssClass="btn btn-primary" ><i class="fa fa-percent"></i></asp:LinkButton>
</div>
@@ -352,7 +353,7 @@
</div>
<div class="form-group form-md-line-input input-iconright" id="DivPersonalReembolso" runat="server" visible="false" >
<div class="form-group form-md-line-input input-iconright" id="DivPersonalReembolso" runat="server" visible="false" >
<asp:DropDownList ID="DdlPersonalReembolso" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="NombreCompletoNombre" DataValueField="CvePersonal" Width="100%" ValidationGroup="GrpGuardar">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
@@ -362,7 +363,87 @@
</asp:RequiredFieldValidator>
</div>
<div class="row" id="DivDeudores" runat="server" visible="false" >
<div class="row" id="RowChkTipoCambio" runat="server">
<div class="col-xs-4">
<asp:CheckBox Text="Pagar con pesos" TextAlign="Right" Visible="false" AutoPostBack="true" ID="ChkPagarPesos" OnCheckedChanged="ChkPagarPesos_CheckedChanged" runat="server" ClientIDMode="Static" />
<asp:CheckBox Text="Pagar con dolares" TextAlign="Right" Visible="false" AutoPostBack="true" ID="ChkPagarDolares" OnCheckedChanged="ChkPagarDolares_CheckedChanged" runat="server" ClientIDMode="Static" />
</div>
</div>
<div class="col-md-12">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlDeudor" runat="server" CssClass="form-control input-sm select2me" AutoPostBack="true" DataTextField="RazonSocialSaldo" DataValueField="ConcatCveIE"
Width="100%" ValidationGroup="GrpGuardar">
</asp:DropDownList>
<label runat="server" id="Label2" for="<%= DdlDeudor.ClientID.ToString()%>">Deudor:</label>
<asp:RequiredFieldValidator ID="RFVDeudores" runat="server" ControlToValidate="DdlDeudor" InitialValue="-1" Display="None"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Deudor''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpRegistraCompra"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RFVDeudores" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
<asp:UpdatePanel ID="UpDeudores" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvDeudores" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron movimientos" DataKeyNames="CveIE,Saldo,RazonSocial,Folio,CveProveedor,SaldoVentas,CveMoneda,TipoCambio"
ToolTip="Listado de Movimientos" data-height="300" Style="width: 100%; height: 100%; text-align: center;" GridLines="None" HeaderStyle-ForeColor="Black">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="Chk" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Fecha</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("FechaDocumento", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Folio</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFolio" runat="server" Text='<%# Eval("Folio") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Saldo</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlSaldo" runat="server" Text='<%# Eval("Saldo", "{0:N2}") %>'></asp:Literal>&nbsp;
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Saldo Abonar</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTotalDeudores" runat="server" ClientIDMode="Static" Text="0.00" Visible="false"></asp:Label>
<asp:TextBox ID="TxtSaldoDeudor" runat="server" CausesValidation="true" MaxLength="12" Width="76px"></asp:TextBox>
<asp:CompareValidator ID="CVAmortAnti" runat="server" ControlToValidate="TxtSaldoDeudor" Display="None" ErrorMessage="El campo <b>''Importe Deudor''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Currency"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOAmortAnti" runat="server" HighlightCssClass="vco" TargetControlID="CVAmortAnti" Width="300px"></ajax:ValidatorCalloutExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtSaldoMonedaOriginal" runat="server" CausesValidation="true" Enabled="False" MaxLength="12" Width="70px" Text="0.00" Style="text-align: right;" BackColor="Transparent" BorderStyle="None" ForeColor="White"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="LbTipoMoneda" runat="server" Style="text-align: left;" Width="30px" Enabled="False" BackColor="Transparent" BorderStyle="None" ForeColor="White" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
@@ -827,6 +908,134 @@
</asp:UpdatePanel>
<%--PRORRATE INICIO--%>
<div id="DVModalProrrateoGasolina" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
<asp:UpdatePanel runat="server" ID="UpProrratearTitulo" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label runat="server" id="LblRiruloProrrareo">Prorratear</asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpModalProrrateoGasolina" UpdateMode="Conditional">
<ContentTemplate>
<%-- <div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<ADS:Dropdownlost runat="server" ID="DdlPSProrrateoGasolina" CssStyle="width:100%" CssClass="form-control input-sm DdlPS" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS" />
<label for="<%= DdlPSProrrateoGasolina.ClientID.ToString()%>">
Productos / Servicio:
<label>
</div>
</div>
</div>--%>
<div class="row" style="margin-top:10px">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoProrrateoGasolina" CssClass=" form-control input-sm select2me" runat="server" Width="100%" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto">
<asp:ListItem Selected="true" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<%--<asp:RequiredFieldValidator ID="RfvDdlSubProyectoProrrateoGasolina" runat="server" ControlToValidate="DdlSubProyectoProrrateoGasolina" CssClass="help-block errorimput" InitialValue="-1"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GprAgregaPSProrateo">
</asp:RequiredFieldValidator>--%>
<label runat="server" id="Label10" for="<%= DdlSubProyectoProrrateoGasolina.ClientID.ToString()%>">
<asp:Label runat="server" id="LblSubProyectoProrrateoGasolina"></asp:Label>:
</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPrecioProrrateoGasolina" ClientIDMode="Static" runat="server" CssClass=" form-control " CausesValidation="true" MaxLength="12" ValidationGroup="GprAgregaPSProrateo"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilTxtPrecioProrrateoGasolina" runat="server" TargetControlID="TxtPrecioProrrateoGasolina" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RfvTxtPrecioProrrateoGasolina" runat="server" ControlToValidate="TxtPrecioProrrateoGasolina" CssClass="help-block errorimput"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgregaPSProrateo">
</asp:RequiredFieldValidator>
<label for="<%= TxtPrecioProrrateoGasolina.ClientID.ToString()%>">Porcentaje:</label>
</div>
</div>
<div class="col-md-4" style="margin-top:10px;text-align:right">
<asp:LinkButton ID="LnkAgregarProrrateoGasolina" OnClick="LnkAgregarProrrateoGasolina_Click" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="GprAgregaPSProrateo" > </asp:LinkButton>
</div>
</div>
<div class="row" style="margin-top:10px">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:Label runat="server" ID="LblTotalProrrateoGasolina" CssClass="form-control" Text="100%"></asp:Label>
<label for="<%= LblTotalProrrateoGasolina.ClientID.ToString()%>">Porcentaje:</label>
</div>
</div>
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:Label runat="server" ID="LblRestoProrrateoGasolina" CssClass="form-control"></asp:Label>
<label for="<%= LblRestoProrrateoGasolina.ClientID.ToString()%>">% Restante:</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvProrrateoGasolina" runat="server" AutoGenerateColumns="false" GridLines="none" BorderWidth="0" Width="100%"
DataKeyNames=""
CssClass="table table-striped table-hover table-advance ScrollAD mysmallbtn">
<Columns>
<asp:BoundField DataField="SubProyecto" HeaderText="SubProyecto" />
<asp:BoundField DataField="Subtotal" HeaderText="Subtotal" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.####}" Visible="false" />
<asp:BoundField DataField="IVA" HeaderText="IVA" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.######}" Visible="false" />
<asp:BoundField DataField="RetIVA" HeaderText="Ret. IVA" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.####}" Visible="false" />
<asp:BoundField DataField="RetISR" HeaderText="RetISR" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0.####}" Visible="false" />
<asp:BoundField DataField="Total" DataFormatString="{0:#,##0.00##}" HeaderText="Total" ItemStyle-HorizontalAlign="Right" Visible="false" />
<asp:BoundField DataField="Porcentaje" DataFormatString="{0:#,##0.00##}" HeaderText="%" ItemStyle-HorizontalAlign="Right" />
<asp:TemplateField ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="LnkEliminarProrrateoGasolina" runat="server" Width="22px"
CssClass="btn btn-circle btn-xs red" OnClick="LnkEliminarProrrateoGasolina_Click"
data-toggle="confirmation"
data-popout="true" data-original-title="¿Seguro que desea eliminar el prorrateo?" data-btn-ok-label="si">
<i style="margin-left:-2px!important" class='icon-trash'></i>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnGuardarProrrateoGasolina" OnClick="BtnGuardarProrrateoGasolina_Click" runat="server" Text="Guardar" CssClass="btn btn-primary" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
<%--PRORRATEO FIN--%>
<div id="divDescripcion" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpDescripcion" UpdateMode="Conditional">
<ContentTemplate>
@@ -1529,8 +1738,7 @@
</asp:UpdatePanel>
</div>
@@ -1552,9 +1760,173 @@
$('#BtnCargaCompraComplementoTraslado').click();
}
//function VinculacionManual(v) {
// $get("HdnCveIE").value = v;
// $('#BtnVincularManualmente').click();
//}
function CambioTipoMoneda() {
var chkPesosBancos = $get("ChkPagarPesos");
var chkDolaresBancos = $get("ChkPagarDolares");
AjustaTextboxDeudores();
if (chkPesosBancos) {
CambiaPesosDolares()
} else if (chkDolaresBancos) {
CambiaDolaresPesos()
} else {
CambiaPesosDolares()
}
}
// CAMBIO DOLARES-PESOS
function CambiaPesosDolares() {
debugger;
if ($("#LbImporteME").length) {
if ($("#TxtTipoCambio").length) {
$get('LbImporteME').value = '$ ' + FormatoNumero(ToDouble(ToDouble($get('TxtImporte').value) / ToDouble($get('TxtTipoCambio').value)), 2) + ' USD';
} else {
$get('LbImporteME').value = '';
}
}
}
function CambiaDolaresPesos() {
debugger;
if ($("#LbImporteMN").length) {
if ($("#TxtTipoCambio").length) {
$get('LbImporteMN').value = '$ ' + FormatoNumero(ToDouble(ToDouble($get('TxtImporte').value) * ToDouble($get('TxtTipoCambio').value)), 2) + ' MXN';
} else {
$get('LbImporteMN').value = ''
}
}
}
function AjustaTextboxDeudores() {
if (!(($("#C_RBLContado_2") && $("#C_RBLContado_2").is(':checked')) || ($("#C_RBLContado_3") && $("#C_RBLContado_3").is(':checked')) || ($("#C_RBLContado_4") && $("#C_RBLContado_4").is(':checked')))) {
return false;
}
var totalPoints = 0.00;
var TC = 1.00;
if ($get("TxtTipoCambio") && ToDouble($get("TxtTipoCambio").value) > 0) {
TC = ToDouble($get("TxtTipoCambio").value);
}
$('input[name*=TxtSaldoDeudor]').each(function () {
totalPoints += ToDouble($(this).val());
if ($("#LbImporteME").length) {
if ($("#TxtTipoCambio").length) {
$(this).parent().next().children('input[name*=TxtSaldoMonedaOriginal]').val(FormatoNumero(ToDouble($(this).val()) / TC, 2));
} else {
$(this).parent().next().children('input[name*=TxtSaldoMonedaOriginal]').val('0.00');
}
} else if ($("#LbImporteMN").length) {
if ($("#TxtTipoCambio").length) {
$(this).parent().next().children('input[name*=TxtSaldoMonedaOriginal]').val(FormatoNumero(ToDouble($(this).val()) * TC, 2));
} else {
$(this).parent().next().children('input[name*=TxtSaldoMonedaOriginal]').val('0.00');
}
}
});
$get('TxtImporte').value = FormatoNumero(totalPoints, 2);
var chkPesosBancos = $get("ChkPagarPesos");
var chkDolaresBancos = $get("ChkPagarDolares");
if (chkPesosBancos) {
CambiaPesosDolares()
} else if (chkDolaresBancos) {
CambiaDolaresPesos()
} else {
CambiaPesosDolares()
}
}
// ajuste Ingresos x comprobar y Deudores
function ClickDeudorChk(Chk, Obj, total, saldo) {
if ($("#" + Chk.id).is(":checked")) {
$('#' + Obj).val(saldo);
}else{
$('#' + Obj).val("");
}
/*
total = ToDouble(ToDouble(total).toFixed(2));
saldo = ToDouble(ToDouble(saldo).toFixed(2));
var totalTC = total;
var TC = 1.00;
if ($get("TxtTipoCambio") && ToDouble($get("TxtTipoCambio").value) > 0) {
TC = ToDouble($get("TxtTipoCambio").value);
total = total * TC;
}
if ($("#" + Chk.id).is(":checked")) {
$('#' + Obj).attr('disabled', false);
if (ToDouble($get('TxtImporte').value) != total) {
if ((ToDouble($get('TxtImporte').value) + saldo) > total) {
$('#' + Obj).val(saldo - (ToDouble($get('TxtImporte').value) + saldo - total));
$get('TxtImporte').value = (total / TC).toFixed(2)
}
else {
if (total > saldo) {
$('#' + Obj).val(saldo);
}
else {
$('#' + Obj).val(total);
}
if (ToDouble($get('TxtImporte').value) >= total) {
$('#' + Obj).val($get(total - 'TxtImporte').value);
$get('TxtImporte').value = (total / TC).toFixed(2)
} else {
$get('TxtImporte').value = (ToDouble($get('TxtImporte').value) + ToDouble($get(Obj).value) / TC).toFixed(2);
}
}
}
else {
$('#' + Obj).val(0);
}
}
else {
$('#' + Obj).attr('disabled', true);
if (ToDouble($get(Obj).value) > 0) {
$get('TxtImporte').value = ToDouble(ToDouble($get('TxtImporte').value) - ToDouble($get(Obj).value)).toFixed(2);
if ($get('TxtImporte').value < 0) {
$get('TxtImporte').value = 0
}
}
$('#' + Obj).val(0);
}
$('#' + Obj).val(ToDouble($get(Obj).value).toFixed(2));
CambioTipoMoneda();
*/
}
</script>
</asp:Content>

View File

@@ -25,6 +25,7 @@ Imports SharpCompress.Archive.Rar
Imports SharpCompress.Common
Imports SharpCompress.Reader
Imports Telerik.Web.UI
Imports System.Data.SqlClient
'Imports Telerik.Web.UI
@@ -756,13 +757,24 @@ Partial Class Compras_eFacturas
End Set
End Property
Private Property CveMonedaFiltros As Integer
Get
If ViewState("CveMonedaFiltros") Is Nothing Then
ViewState("CveMonedaFiltros") = -1
End If
Return ViewState("CveMonedaFiltros").ToString.ToEntero
End Get
Set(value As Integer)
ViewState("CveMonedaFiltros") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
'EsGrupoDiaz = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False)
EsGrupoDiaz = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False)
ChecandoCorreo = False
@@ -816,12 +828,16 @@ Partial Class Compras_eFacturas
CargaPersonalViaticos()
CargaDdlRetIVA()
CargaDdlRetISR()
CargaDeudores()
End If
Dim LblSubProyectoTemp As New Label
CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyectoTemp, "Seleccione")
LblSubProyecto.InnerText = $"{LblSubProyectoTemp.Text}:"
InicializaDTProrrateoGasolina()
End If
removeasincevent()
End Sub
@@ -1146,6 +1162,8 @@ Partial Class Compras_eFacturas
End If
End If
e.Row.FCCheckBox("chkRegistraFactura").Attributes.Add("onclick", "ChkRegsitraFacturas()")
End If
End Sub
Protected Sub GvDatos_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvD.RowUpdating
@@ -5176,6 +5194,23 @@ Partial Class Compras_eFacturas
End Property
Private Property DtDeudoresDetalle As DataTable
Get
Return CType(ViewState("DtDeudoresDetalle"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDeudoresDetalle") = value
End Set
End Property
Private Property DtDeudores As DataTable
Get
Return CType(ViewState("DtDeudores"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDeudores") = value
End Set
End Property
Private Sub CargaClasificacionesComprobaciones()
@@ -5268,7 +5303,7 @@ Partial Class Compras_eFacturas
DivPersonalReembolso.Visible = False
DivCuentaCajaChicaReembolso.Visible = False
DivDeudores.Visible = False
Select Case RBLContado.SelectedValue
@@ -5280,6 +5315,10 @@ Partial Class Compras_eFacturas
DivCuentaCajaChicaReembolso.Visible = True
RfvTxtNumeroReembolso.Enabled = True
Case "4" ' Deudores
DivDeudores.Visible = True
RfvTxtNumeroReembolso.Enabled = False
End Select
UpRegistroFacturas.Update()
@@ -5314,8 +5353,64 @@ Partial Class Compras_eFacturas
DdlRetISRConcepto.Items.Insert(1, New ListItem("Resico", "3"))
End Sub
Protected Sub CargaDeudores(Optional CveMoneda As Integer = 1)
Dim Deudores As New ClsMovimientos
DdlDeudor.Items.Clear()
If Deudores.GetDeudoresSaldos2(-1, UsuarioActual.CveEmpresa) Then
DtDeudores = Deudores.DtResultados.FiltraParametros($"CveProveedor > 0 AND Saldo > 0 AND CveMoneda = {CveMoneda}")
DdlDeudor.DataSource = DtDeudores
DdlDeudor.DataBind()
DdlDeudor.Items.Insert(0, New ListItem("Seleccione Deudor", "-1"))
UpDatos.Update()
CambieDeudor()
End If
Deudores.Dispose()
End Sub
Private Sub DdlDeudor_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlDeudor.SelectedIndexChanged
CambieDeudor()
End Sub
Private Sub CambieDeudor()
Dim stringDeudor As String = DdlDeudor.SelectedItem.ToString
Dim SaldoD As Decimal = stringDeudor.Substring(stringDeudor.IndexOf("$") + 1, stringDeudor.Length - (stringDeudor.IndexOf("$") + 1)).ToDecimal
If DdlDeudor.SelectedValue.ToEntero > 0 Then
Dim Deudores As New ClsMovimientos
Dim OpcionSaldo As Integer = 1
If Deudores.GetDeudoresSaldosDetalle(DdlDeudor.SelectedValue.ToEntero, CveMonedaFiltros, UsuarioActual.CveEmpresa) Then
DtDeudoresDetalle = Deudores.DtResultados.FiltraParametros("CveProveedor > 0 AND Saldo > 0")
GvDeudores.DataSource = DtDeudoresDetalle.FiltraParametros("CveMoneda = 1")
GvDeudores.DataBind()
End If
Deudores.Dispose()
Else
GvDeudores.DataSource = Nothing
GvDeudores.DataBind()
End If
UpDeudores.Update()
End Sub
Private Sub GvDeudores_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDeudores.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim total As Decimal
Dim saldo As Decimal
saldo = e.Row.DataKey("Saldo").ToDecimal
total = 0D
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("ClickDeudorChk(this, ""{0}"", ""{1}"", ""{2}"")", e.Row.FCTextBox("TxtSaldoDeudor").ClientID, total, saldo))
e.Row.FCTextBox("TxtSaldoDeudor").Attributes.Add("onKeyUp", "AjustaTextboxDeudores();")
e.Row.FCTextBox("LbTipoMoneda").Text = If(e.Row.DataKey("CveMoneda").ToString.ToEntero = 1, "USD", " MXN")
Dim rv As RangeValidator = CType(e.Row.FindControl("RVSaldoDeudor"), RangeValidator)
End If
End Sub
Protected Sub DdlPersonal2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPersonalReembolso.SelectedIndexChanged
ViewState("CvePersonal") = DdlPersonalReembolso.SelectedValue
If DdlPersonalReembolso.SelectedValue.ToEntero > 0 Then
@@ -5332,6 +5427,276 @@ Partial Class Compras_eFacturas
ViewState("CveCajaChica") = DdlCuentaCajaChicaReembolso.SelectedValue
End Sub
#End Region
#Region "PRORATEO"
#Region "PRORRATEO GASOLINA"
Protected Sub LnlMostarProrateo_Click(sender As Object, e As EventArgs)
'InicializaDTProrrateoGasolina()
CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoProrrateoGasolina,)
GvProrrateoGasolina.Columns(0).HeaderText = LblSubProyectoProrrateoGasolina.Text
LblRiruloProrrareo.Text = $"Prorratear por { LblSubProyectoProrrateoGasolina.Text}"
DdlSubProyectoProrrateoGasolina.Items.Clear()
DdlSubProyectoProrrateoGasolina.DataSource = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveProyecto:=-1))
DdlSubProyectoProrrateoGasolina.DataBind()
DdlSubProyectoProrrateoGasolina.Items.Insert(0, New ListItem("Todos", "-1"))
'LblTotalProrrateoGasolina.Text = TxtTotal.Text
'CargaProrratePS(-1)
RegistraScript("$('#DVModalProrrateoGasolina').modal();")
UpModalProrrateoGasolina.Update()
UpProrratearTitulo.Update()
'DdlPS.txtText.Value = DdlPS.txtText.Value
'DdlPS.txtValue.Value = DdlPS.txtValue.Value
'UpRegistroFacturas.Update()
End Sub
Property DTProrrateoTmp As DataTable
Get
If ViewState("DTProrrateoTmp") Is Nothing Then
ViewState("DTProrrateoTmp") = New DataTable
End If
Return DirectCast(ViewState("DTProrrateoTmp"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTProrrateoTmp") = value
End Set
End Property
Property DTProrrateo As DataTable
Get
If ViewState("DTProrrateo") Is Nothing Then
ViewState("DTProrrateo") = New DataTable
End If
Return DirectCast(ViewState("DTProrrateo"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTProrrateo") = value
End Set
End Property
Property ProrratearFacturas As Boolean
Get
If ViewState("ProrratearFacturas") Is Nothing Then
ViewState("ProrratearFacturas") = False
End If
Return Boolean.Parse(ViewState("ProrratearFacturas").ToString)
End Get
Set(value As Boolean)
ViewState("ProrratearFacturas") = value
End Set
End Property
Private Sub InicializaDTProrrateoGasolina()
Dim TmpDTProrrateoGasolina As New DataTable
TmpDTProrrateoGasolina.Columns.Add("CvePS", GetType(Integer))
TmpDTProrrateoGasolina.Columns.Add("CveSubProyecto", GetType(Integer))
TmpDTProrrateoGasolina.Columns.Add("SubProyecto", GetType(String))
TmpDTProrrateoGasolina.Columns.Add("SubTotal", GetType(Decimal))
TmpDTProrrateoGasolina.Columns.Add("IVA", GetType(Decimal))
TmpDTProrrateoGasolina.Columns.Add("RetIVA", GetType(Decimal))
TmpDTProrrateoGasolina.Columns.Add("RetISR", GetType(Decimal))
TmpDTProrrateoGasolina.Columns.Add("Total", GetType(Decimal))
TmpDTProrrateoGasolina.Columns.Add("PorcentajeIVA", GetType(Decimal))
TmpDTProrrateoGasolina.Columns.Add("RetISRPorcentaje", GetType(Decimal))
TmpDTProrrateoGasolina.Columns.Add("RetIVAPorcentaje", GetType(Decimal))
TmpDTProrrateoGasolina.Columns.Add("CveUM", GetType(Integer))
TmpDTProrrateoGasolina.Columns.Add("CveClasificacion", GetType(Integer))
TmpDTProrrateoGasolina.Columns.Add("UM", GetType(String))
TmpDTProrrateoGasolina.Columns.Add("Clasificacion", GetType(String))
TmpDTProrrateoGasolina.Columns.Add("PS", GetType(String))
TmpDTProrrateoGasolina.Columns.Add("Porcentaje", GetType(Decimal))
DTProrrateoTmp = TmpDTProrrateoGasolina
End Sub
Protected Sub LnkProrrateoGasolina_Click(sender As Object, e As EventArgs)
CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoProrrateoGasolina,)
GvProrrateoGasolina.Columns(0).HeaderText = LblSubProyectoProrrateoGasolina.Text
LblRiruloProrrareo.Text = $"Prorratear por { LblSubProyectoProrrateoGasolina.Text}"
DdlSubProyectoProrrateoGasolina.Items.Clear()
DdlSubProyectoProrrateoGasolina.DataSource = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveProyecto:=-1))
DdlSubProyectoProrrateoGasolina.DataBind()
DdlSubProyectoProrrateoGasolina.Items.Insert(0, New ListItem("Todos", "-1"))
RegistraScript("$('#DVModalProrrateoGasolina').modal();")
UpModalProrrateoGasolina.Update()
UpProrratearTitulo.Update()
End Sub
Private Sub GvProrrateoGasolinaBind()
GvProrrateoGasolina.DataSource = DTProrrateoTmp
GvProrrateoGasolina.DataBind()
UpModalProrrateoGasolina.Update()
End Sub
Protected Sub LnkEliminarProrrateoGasolina_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
DTProrrateoTmp.Rows.RemoveAt(GvRow.RowIndex)
DTProrrateoTmp.AcceptChanges()
ProrateoCalculaRestante()
GvProrrateoGasolinaBind()
End Sub
Protected Sub LnkAgregarProrrateoGasolina_Click(sender As Object, e As EventArgs)
Dim CvePs As Integer = DdlPS.SelectedValue.ToEntero
If Not CvePs > 0 Then
Alert("Debe seleccionar un producto", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim PsRow As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePs).FiltroPrimero("")
If PsRow Is Nothing Then
Alert("No se encontro el producto", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim CveUM As Integer = PsRow("CveUM").ToString.ToEntero
Dim UM As String = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("UnidadMedida", $" CveUnidadMedida = {CveUM} ")
Dim CveClasificacion As Integer = PsRow("CveClasificacion").ToString.ToEntero
Dim Clasificacion As String = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $" CveClasificacion = {CveClasificacion} ")
If DdlSubProyectoProrrateoGasolina.SelectedValue.ToEntero > 0 Then
AgregarProrrateoGasolina(DdlSubProyectoProrrateoGasolina.SelectedValue.ToEntero, DdlSubProyectoProrrateoGasolina.SelectedItem.Text, CvePs, CveUM, UM, CveClasificacion, Clasificacion)
Else
DTProrrateoTmp.Rows.Clear()
For Each item As ListItem In DdlSubProyectoProrrateoGasolina.Items
If item.Value.ToEntero > 0 Then
AgregarProrrateoGasolina(item.Value.ToEntero, item.Text, CvePs, CveUM, UM, CveClasificacion, Clasificacion)
End If
Next
End If
TxtPrecioProrrateoGasolina.Text = ""
DdlSubProyectoProrrateoGasolina.SelectedValueExist(-1)
UpModalProrrateoGasolina.Update()
End Sub
Private Sub AgregarProrrateoGasolina(CveSubProyecto As Integer, SubProyecto As String, CvePS As Integer, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String)
''' este prco3eso compratira todo esto se debe de llevar a la genracion de la factura por porcentaje
Dim SubTotalOriginal As Decimal = 1
Dim IVAOriginal As Decimal = 0D 'TxtIVA.Text.ToDecimal
Dim RetISROriginal As Decimal = 0D 'TxtRetISR.Text.ToDecimal
Dim RetIVAOriginal As Decimal = 0D 'TxtRetIVA.Text.ToDecimal
Dim TotalOriginal As Decimal = 1
Dim totalParcialDeseado As Decimal = TxtPrecioProrrateoGasolina.Text.ToDecimal
Dim PorcentajeCalculado As Decimal = totalParcialDeseado / TotalOriginal
Dim subtotalParcial As Decimal = SubTotalOriginal * PorcentajeCalculado
Dim ivaParcial As Decimal = IVAOriginal * PorcentajeCalculado
Dim retIsrParcial As Decimal = RetISROriginal * PorcentajeCalculado
Dim retIvaParcial As Decimal = RetIVAOriginal * PorcentajeCalculado
Dim nRow As DataRow = DTProrrateoTmp.NewRow
nRow("CvePS") = DdlPS.SelectedValue.ToEntero
nRow("CveSubProyecto") = CveSubProyecto
nRow("SubProyecto") = SubProyecto
'If CveFactura > 0 Then
nRow("IVA") = ivaParcial.RoundSQL(4)
nRow("RetIVA") = retIvaParcial.RoundSQL(4)
nRow("RetISR") = retIsrParcial.RoundSQL(4)
'Else
'nRow("IVA") = (ivaParcial / subtotalParcial).RoundSQL(4)
'nRow("RetIVA") = (retIvaParcial / subtotalParcial).RoundSQL(4)
'nRow("RetISR") = (retIsrParcial / subtotalParcial).RoundSQL(4)
'End If
nRow("SubTotal") = subtotalParcial.RoundSQL(4)
nRow("Total") = totalParcialDeseado.RoundSQL(4)
nRow("PorcentajeIVA") = (ivaParcial / subtotalParcial).RoundSQL(4)
nRow("Porcentaje") = TxtPrecioProrrateoGasolina.Text.ToDecimal '((totalParcialDeseado.RoundSQL(4) * 100) / TotalOriginal).RoundSQL(2)
'nRow("RetIVAPorcentaje") = (retIvaParcial / subtotalParcial).RoundSQL(4)
'nRow("RetISRPorcentaje") = (retIsrParcial / subtotalParcial).RoundSQL(4)
nRow("CveUM") = CveUM
nRow("UM") = UM
nRow("CveClasificacion") = CveClasificacion
nRow("Clasificacion") = Clasificacion
nRow("PS") = DdlPS.txtText.Value
DTProrrateoTmp.Rows.Add(nRow)
ProrateoCalculaRestante()
GvProrrateoGasolinaBind()
End Sub
Function ProrateoCalculaRestante(Optional MostrarMensaje As Boolean = False) As Boolean
'''Esto no aplica por que es por factura
Dim Acumulado As Decimal = DTProrrateoTmp.SUM("Porcentaje").RoundSQL(2)
Dim Total As Decimal = 100 'TxtTotal.Text.ToDecimal.RoundSQL(2)
Dim Respuesta As Boolean = False
LblRestoProrrateoGasolina.Text = (Total - Acumulado).ToString("###,###,###.00")
If Acumulado = Total Then
Respuesta = True
Else
Respuesta = False
If MostrarMensaje Then
If Acumulado <> Total Then
Alert($"El porcentaje prorrateado es diferente de 100%, Diferencia: {(Acumulado - Total).Abs()}, Prorrateado:{Acumulado.ToString("###,###,###.00")}", TipoMensaje.MsgAdvertencia)
End If
End If
End If
Return Respuesta
End Function
Protected Sub BtnGuardarProrrateoGasolina_Click(sender As Object, e As EventArgs)
If Not ProrateoCalculaRestante(True) Then
Exit Sub
End If
DTProrrateo = DTProrrateoTmp
RegistraScript("$('#DVModalProrrateoGasolina').modal('hide');")
End Sub
#End Region
#End Region
Protected Sub LnkRegistarFactura_Click(sender As Object, e As EventArgs)
@@ -5353,9 +5718,52 @@ Partial Class Compras_eFacturas
Exit Sub
End If
If RBLContado.SelectedValue.ToEntero = 4 Then
If Not validaPagoDeudores() Then
Exit Sub
End If
End If
Dim Objcompras As New ClsCompras
Objcompras.IniciaTransacSQL()
Dim DTPagosDeudores As New DataTable
DTPagosDeudores.Columns.Add("CveIE", GetType(Decimal))
DTPagosDeudores.Columns.Add("Saldo", GetType(Decimal))
DTPagosDeudores.Columns.Add("RazonSocial", GetType(String))
DTPagosDeudores.Columns.Add("Folio", GetType(String))
DTPagosDeudores.Columns.Add("CveProveedor", GetType(Integer))
DTPagosDeudores.Columns.Add("SaldoVentas", GetType(Decimal))
DTPagosDeudores.Columns.Add("CveMoneda", GetType(Integer))
DTPagosDeudores.Columns.Add("TCPago", GetType(Decimal))
DTPagosDeudores.Columns.Add("ImportePago", GetType(Decimal))
For Each rw As GridViewRow In GvDeudores.Rows
If rw.FCCheckBox("Chk").Checked AndAlso rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal <> 0 Then
Dim nRow As DataRow = DTPagosDeudores.NewRow
nRow("CveIE") = rw.DataKey("CveIE").ToEntero
nRow("CveMoneda") = rw.DataKey("CveMoneda").ToEntero
nRow("ImportePago") = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
nRow("TCPago") = rw.DataKey("TipoCambio").ToDecimal
nRow("CveProveedor") = DdlDeudor.SelectedValue.ToEntero
nRow("Saldo") = rw.DataKey("Saldo").ToDecimal
DTPagosDeudores.Rows.Add(nRow)
End If
Next
For Each GvRow As GridViewRow In GvD.Rows
If GvRow.FCCheckBox("chkRegistraFactura").Checked Then
Dim TotalFactura As Decimal = GvRow.DataKey("Total").ToDecimal
Dim SaldoFactura As Decimal = TotalFactura
Dim CFDIXmlPath As String = $"{UsuarioActual.Empresa.Ruta}Compras\{GvRow.DataKey("RFCDe")}\{GvRow.DataKey("XML")}"
If Not File.Exists(CFDIXmlPath) Then
ErrorProceso = True
@@ -5376,35 +5784,295 @@ Partial Class Compras_eFacturas
Dim CvePersonal As Integer = -1 'DdlPersonalReembolso.SelectedValue.ToEntero
Dim CveCajachica As Integer = -1 'DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero
If RBLContado.SelectedValue.ToEntero = 6 Then
If RBLContado.SelectedValue.ToEntero = 6 Then 'Caja Chica
CveCajachica = DdlCuentaCajaChicaReembolso.SelectedValue.ToEntero
Else
ElseIf RBLContado.SelectedValue.ToEntero = 2 Then ' viaticos
CvePersonal = DdlPersonalReembolso.SelectedValue.ToEntero
ElseIf RBLContado.SelectedValue.ToEntero = 4 Then ' deudores
End If
CompraActual.ConfiguraRegistroRapidoReembolso(DdlPS.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, CveCajachica, CvePersonal,
DdlRetIVAConcepto.SelectedValue.ToEntero, DdlRetISRConcepto.SelectedValue.ToEntero, NumeroReembolso:=TxtNumeroReembolso.Text)
If CompraActual.AddCompra() Then
Contador = Contador + 1
If CompraActual.ConfiguraRegistroCompra(DdlPS.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, CveCajachica, CvePersonal,
DdlRetIVAConcepto.SelectedValue.ToEntero, DdlRetISRConcepto.SelectedValue.ToEntero, NumeroReembolso:=TxtNumeroReembolso.Text,
DTProrrateo:=DTProrrateo, DTPagosDeudores:=DTPagosDeudores) Then
If CompraActual.AddCompra(Objcompras.IniciaTransacSQL()) Then
Contador = Contador + 1
Else
ErrorProceso = True
ErrorProcesoStr = CompraActual.MensajeError
Exit For
End If
Else
ErrorProceso = True
ErrorProcesoStr = CompraActual.MensajeError
Exit For
End If
If RBLContado.SelectedValue.ToEntero = 4 Then 'Deudores
Dim CompraActualPagar = New Compra
If Objcompras.GetCompras(CompraActual.CveCompra, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
If Objcompras.DtResultados IsNot Nothing AndAlso Objcompras.DtResultados.Rows.Count > 0 Then
Dim dr As DataRow = Objcompras.DtResultados.Rows(0)
CompraActualPagar.CveCompra = CompraActual.CveCompra
CompraActualPagar.CveTipoConceptoProveedor = dr("CveTipoConcepto").ToString.ToEntero
CompraActualPagar.CveProveedor = dr("CveProveedor").ToString.ToEntero
CompraActualPagar.CveMoneda = dr("CveMoneda").ToString.ToEntero
CompraActualPagar.Fecha = dr("Fecha").ToString.ToDate
CompraActualPagar.SerieFolio = dr("SerieFolio").ToString
'CompraActualPagar.ProveedorNombre = TxtPagueseA.Text
CompraActualPagar.TC = dr("TipoCambio").ToString.ToDecimal
CompraActualPagar.Total = dr("Total").ToString.ToDecimal
CompraActualPagar.IVA = dr("IVA").ToString.ToDecimal
CompraActualPagar.IVADeducible = dr("IVADeducible").ToString.ToDecimal.RoundSQL
CompraActualPagar.IVANoDeducible = dr("IVANoDeducible").ToString.ToDecimal.RoundSQL
CompraActualPagar.IEPS = dr("IEPS").ToString.ToDecimal
CompraActualPagar.RetIVA = dr("RetIVA").ToString.ToDecimal
CompraActualPagar.RetISR = dr("RetISR").ToString.ToDecimal
CompraActualPagar.CveConceptoRetIVA = dr("CveRetIVAConcepto").ToString.ToEntero
CompraActualPagar.CveConceptoRetISR = dr("CveRetISRConcepto").ToString.ToEntero
CompraActualPagar.PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal
CompraActualPagar.UsuarioActual = UsuarioActual
CompraActualPagar.CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero
CompraActualPagar.EsImportacion = CBool(dr("EsImportacion"))
CompraActualPagar.CompraNoDeducible = dr("NoDeducible").ToString.ToEntero
''Tipos de cambio
'If Pago.CveMonedaPago = 1 AndAlso CompraActualPagar.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en Pesos
' Pago.TCCambioMoneda = 1 / TxtTipoCambio.Text.ToDecimal
'ElseIf Pago.CveMonedaPago = 2 AndAlso CompraActualPagar.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES
' Pago.TCPago = TxtTipoCambio.Text.ToDecimal
'ElseIf Pago.CveMonedaPago = 2 AndAlso CompraActualPagar.CveMoneda = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
' Pago.TCPago = TxtTipoCambio.Text.ToDecimal
' Pago.TCCambioMoneda = TxtTipoCambio.Text.ToDecimal
'End If
Else
ErrorProceso = True
End If
Else
ErrorProceso = True
End If
If Not ErrorProceso Then
Dim Pago As New CompraPago
Pago.Fecha = NowADS()
Pago.CveMonedaPago = 1
Dim ObjMov As New ClsContabilidad(Objcompras.IniciaTransacSQL())
Dim CvePlantillaPoliza As Integer = 2
Dim porAplicar As Decimal = DTPagosDeudores.SUM("ImportePago")
While (SaldoFactura > 0 Or porAplicar <= 0) And (ErrorProceso = False)
For Each dRow As DataRow In DTPagosDeudores.Rows
' Dim SaldoDeudor As Decimal = dRow("Saldo").ToString.ToDecimal
Dim MaxPago As Decimal = dRow("ImportePago").ToString.ToDecimal
Dim ImportePagado As Decimal = 0D
If MaxPago > 0 Then
If MaxPago > SaldoFactura Then
ImportePagado = SaldoFactura
dRow("ImportePago") = (MaxPago - TotalFactura)
Else
ImportePagado = MaxPago
dRow("ImportePago") = 0
End If
Dim CvePrePoliza As Integer = ObjMov.AddPrePolizas("Bancos/PopIECompras", CvePlantillaPoliza, ImportePagado, ImportePagado, Pago.CveMonedaPago, NowADS, "Registro factuta eFacturas", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
Pago.CveIE = dRow("CveIE").ToString.ToEntero
Pago.CveMonedaPago = dRow("CveMoneda").ToString.ToEntero
Pago.ImportePago = ImportePagado
Pago.TCPago = 1
Pago.CveProveedor = DdlDeudor.SelectedValue.ToEntero
Pago.TipoPago = "DD"
If AplicaPrePolizaPagoCompra(CompraActualPagar, Pago, CvePrePoliza, ObjMov) Then
ErrorProceso = True
Exit For
End If
End If
SaldoFactura = (SaldoFactura - ImportePagado)
Next
porAplicar = DTPagosDeudores.SUM("ImportePago")
End While
End If
End If
End If
If ErrorProceso Then
Exit For
End If
Next
If Not ErrorProceso Then
If ErrorProceso Then
Objcompras.RollBack()
Alert($"Se registraron {Contador} Compras. error {ErrorProcesoStr}", TipoMensaje.MsgAdvertencia)
Else
Objcompras.Commit()
CargaDatos(NowADS())
CambieDeudor()
CargaDatos(NowADS())
If Contador > 0 Then
Alert($"Se registraron {Contador} Compras")
End If
Else
Alert($"Se registraron {Contador} Compras. error {ErrorProcesoStr}", TipoMensaje.MsgAdvertencia)
End If
Objcompras.Dispose()
End Sub
Protected Sub ChkPagarPesos_CheckedChanged(sender As Object, e As EventArgs)
'If ChkPagarPesos.Checked Then
' DivTipoCambio.Visible = True
' CargaCuentas()
' CargaOtrosIngresos(1)
' CargaDeudores(1)
' CargaAcreedores(1)
' CargaVentas(1)
' CveMonedaFiltros = 1
' TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
' TxtTipoCambio.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
' GvIngresos.Columns(5).Visible = True
' GvIngresos.Columns(6).Visible = True
' GvDeudores.Columns(5).Visible = True
' GvDeudores.Columns(6).Visible = True
' 'RVImporte.Enabled = False
' ' RVImporte.MaximumValue = "0.00"
' CVImporteDolares.Enabled = True
'Else
' DivTipoCambio.Visible = False
' CargaCuentas()
' CargaOtrosIngresos(2)
' CargaDeudores(2)
' CargaAcreedores(2)
' CargaVentas(2)
' CveMonedaFiltros = 2
' TxtFechaDocumento.Attributes.Remove("onchange")
' GvIngresos.Columns(5).Visible = False
' GvIngresos.Columns(6).Visible = False
' GvDeudores.Columns(5).Visible = False
' GvDeudores.Columns(6).Visible = False
' 'RVImporte.Enabled = True
' 'RVImporte.MaximumValue = LtlSaldo.Text.ToDecimal.ToString
' CVImporteDolares.Enabled = False
' CVImportePesos.Enabled = False
'End If
'UpDatos.Update()
'RegistraScript("CambiaPesosDolares();")
End Sub
Protected Sub ChkPagarDolares_CheckedChanged(sender As Object, e As EventArgs)
'If ChkPagarDolares.Checked Then
' DivTipoCambio.Visible = True
' CargaCuentas()
' CargaOtrosIngresos(2)
' CargaDeudores(2)
' CargaAcreedores(2)
' CargaVentas(2)
' CveMonedaFiltros = 2
' TxtFechaDocumento.Attributes.Add("onchange", "CambiaTC(this);")
' TxtTipoCambio.Text = GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).FormatoNumero(4)
' GvIngresos.Columns(5).Visible = True
' GvIngresos.Columns(6).Visible = True
' GvDeudores.Columns(5).Visible = True
' GvDeudores.Columns(6).Visible = True
' 'RVImporte.Enabled = False
' 'RVImporte.MaximumValue = "0.00"
' CVImportePesos.Enabled = True
'Else
' DivTipoCambio.Visible = False
' CargaCuentas()
' CargaOtrosIngresos(1)
' CargaDeudores(1)
' CargaAcreedores(1)
' CargaVentas(1)
' CveMonedaFiltros = 1
' TxtFechaDocumento.Attributes.Remove("onchange")
' GvIngresos.Columns(5).Visible = False
' GvIngresos.Columns(6).Visible = False
' GvDeudores.Columns(5).Visible = False
' GvDeudores.Columns(6).Visible = False
' ' RVImporte.Enabled = True
' 'RVImporte.MaximumValue = LtlSaldo.Text.ToDecimal.ToString
' CVImporteDolares.Enabled = False
' CVImportePesos.Enabled = False
'End If
'UpDatos.Update()
'RegistraScript("CambiaDolaresPesos();")
End Sub
Function validaPagoDeudores() As Boolean
Dim respuesta As Boolean = True
Dim totalFacturas As Decimal = 0D
Dim totalDeudores As Decimal = 0D
For Each gvRow As GridViewRow In GvDeudores.Rows
If gvRow.FCCheckBox("Chk").Checked Then
'totalDeudores = totalDeudores + gvRow.DataKey("Saldo").ToDecimal
totalDeudores = totalDeudores + gvRow.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
End If
Next
For Each gvRow As GridViewRow In GvD.Rows
If gvRow.FCCheckBox("chkRegistraFactura").Checked Then
totalFacturas = totalFacturas + gvRow.DataKey("Total").ToDecimal
End If
Next
If totalFacturas > totalDeudores Then
respuesta = False
Alert("El importe de lasf acturas es superior al importe de deudores selecionado", TipoMensaje.MsgAdvertencia)
End If
Return respuesta
End Function
End Class
@@ -5630,6 +6298,7 @@ Public Class ClsCompraManager
Public Property CveCreditoDetalle As Integer = -1
Public Property CveIE As Integer = -1
Public Property CveCompraAmortizacion As Integer = -1
Public Property DTPagosDeudores As DataTable
Public Sub New(XmlFuente As String, OpcionCarga As EnumCargaCompra, DTTiposGastos As DataTable, UsuarioActual As Usuario)
@@ -5940,7 +6609,7 @@ Public Class ClsCompraManager
#End Region
End Sub
Public Function ConfiguraRegistroRapidoReembolso(CvePS As Integer, CveSubProyecto As Integer, CveCajaChica As Integer, CvePersonal As Integer, CveRetIVAConcepto As Integer, CveRetISRConcepto As Integer, NumeroReembolso As String) As Boolean
Public Function ConfiguraRegistroCompra(CvePS As Integer, CveSubProyecto As Integer, CveCajaChica As Integer, CvePersonal As Integer, CveRetIVAConcepto As Integer, CveRetISRConcepto As Integer, NumeroReembolso As String, DTProrrateo As DataTable, DTPagosDeudores As DataTable) As Boolean
Dim respuesta As Boolean = True
Me.CveSubProyecto = CveSubProyecto
@@ -5951,6 +6620,7 @@ Public Class ClsCompraManager
Me.CveRetISRConcepto = CveRetISRConcepto
Me.CveTipoPoliza = 3
Me.NumeroReembolso = NumeroReembolso
Me.DTPagosDeudores = DTPagosDeudores
Dim dRowSubProyecto As DataRow = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyecto).FiltroPrimero("")
@@ -5983,10 +6653,100 @@ Public Class ClsCompraManager
respuesta = False
End If
respuesta = Prorratear(DTProrrateo)
Return respuesta
End Function
Function Prorratear(DtProrrateo As DataTable) As Boolean
Dim Respuesta As Boolean = True
If DtProrrateo.Rows.Count > 0 Then
Dim DT_Impuestos As DataTable = TmpDT.FiltraParametros("", "", {"IVAPorcentaje", "RetIVAPorcentaje", "RetISRPorcentaje"})
Dim TmpDTCopy As DataTable = TmpDT.Copy
TmpDT.Rows.Clear()
Dim SubTotalOriginal As Decimal = SubTotal
Dim IVAOriginal As Decimal = IVA
Dim RetISROriginal As Decimal = RetISR
Dim RetIVAOriginal As Decimal = RetIVA
Dim TotalOriginal As Decimal = Total
Dim DescuentoOriginal As Decimal = Descuento
For Each dRowImp As DataRow In DT_Impuestos.Rows
Dim impPorcentajeIVA As Decimal = dRowImp("IVAPorcentaje").ToString.ToDecimal
Dim impRetIVAPorcentaje As Decimal = dRowImp("RetIVAPorcentaje").ToString.ToDecimal
Dim impRetISRPorcentaje As Decimal = dRowImp("RetISRPorcentaje").ToString.ToDecimal
Dim ImpSubTotal As Decimal = TmpDTCopy.SUM("Total", $" (IVAPorcentaje = {impPorcentajeIVA} OR IVAPorcentaje IS NULL ) AND (RetIVAPorcentaje = {impRetIVAPorcentaje} OR RetIVAPorcentaje IS NULL) AND (RetISRPorcentaje = {impRetISRPorcentaje} OR RetISRPorcentaje IS NULL)")
Dim ImpIVA As Decimal = TmpDTCopy.SUM("IVA", $" (IVAPorcentaje = {impPorcentajeIVA} OR IVAPorcentaje IS NULL ) AND (RetIVAPorcentaje = {impRetIVAPorcentaje} OR RetIVAPorcentaje IS NULL) AND (RetISRPorcentaje = {impRetISRPorcentaje} OR RetISRPorcentaje IS NULL)")
Dim impTotal As Decimal = (ImpSubTotal + ImpIVA)
For Each dRow As DataRow In DtProrrateo.Rows
Dim totalParcialDeseado As Decimal = (dRow("Porcentaje").ToString.ToDecimal / 100D) * impTotal
Dim PorcentajeCalculado As Decimal = totalParcialDeseado / impTotal
Dim subtotalParcial As Decimal = ImpSubTotal * PorcentajeCalculado
Dim ivaParcial As Decimal = ImpIVA * PorcentajeCalculado
Dim retIsrParcial As Decimal = impRetISRPorcentaje * PorcentajeCalculado
Dim retIvaParcial As Decimal = impRetIVAPorcentaje * PorcentajeCalculado
Dim nIVA As Decimal = ivaParcial.RoundSQL(6)
Dim nRetIVA As Decimal = retIvaParcial.RoundSQL(6)
Dim nRetISR As Decimal = retIsrParcial.RoundSQL(6)
Dim nSubTotal As Decimal = subtotalParcial.RoundSQL(6)
Dim nTotal As Decimal = totalParcialDeseado.RoundSQL(6)
Dim nPorcentajeIVA As Decimal = impPorcentajeIVA '(ivaParcial / subtotalParcial).RoundSQL(4)
Dim nPorcentaje As Decimal = ((totalParcialDeseado.RoundSQL(4) * 100) / impTotal).RoundSQL(4)
Dim nRetIVAPorcentaje As Decimal = (retIvaParcial / subtotalParcial).RoundSQL(4)
Dim nRetISRPorcentaje As Decimal = (retIsrParcial / subtotalParcial).RoundSQL(4)
AddPS(1, dRow("CveUM").ToString.ToEntero, dRow("UM").ToString, dRow("CveClasificacion").ToString.ToEntero, dRow("Clasificacion").ToString, dRow("CvePS").ToString.ToEntero, dRow("PS").ToString, 1, dRow("CveSubProyecto").ToString, dRow("SubProyecto").ToString, "",
"-1", "", nSubTotal, nTotal, nIVA, nRetIVA, nRetISR, 0, 0, 0, PorcentajeIVA:=nPorcentajeIVA,
CargaXml:=True, PorcentajeRetIVA:=nRetIVAPorcentaje, PorcentajeRetISR:=nRetISRPorcentaje)
Next
Next
Dim SubTotalDetalle As Decimal = TmpDT.SUM("Total")
Dim IVADetalle As Decimal = TmpDT.SUM("IVA")
Dim RetIVADetalle As Decimal = TmpDT.SUM("RetIVA")
Dim RetISRDetalle As Decimal = TmpDT.SUM("RetISR")
Dim DescuentoDetalle As Decimal = TmpDT.SUM("Descuento")
Dim Diferencia As Decimal = (TotalOriginal - (SubTotalDetalle + IVADetalle - RetIVADetalle - RetISRDetalle - DescuentoDetalle)).RoundSQL
If Math.Abs(Diferencia) > 0.01 Then
Respuesta = False
Else
Total = Total.RoundSQL
SubTotal = SubTotal.RoundSQL
IVA = IVA.RoundSQL
RetISR = RetISR.RoundSQL
RetIVA = RetIVA.RoundSQL
End If
End If
Return Respuesta
End Function
Private Function AjustesValidacion() As Boolean
Dim respuesta As Boolean = True
'VALIDA IMPORTES
@@ -7055,12 +7815,13 @@ Public Class ClsCompraManager
End If
End Function
Public Function AddCompra() As Boolean
Public Function AddCompra(ByRef transaccion As SqlTransaction) As Boolean
If Not AjustesValidacion() Then Return False
Dim respuesta As Boolean = True
Dim ObjCompras As New ClsCompras
Dim ObjCompras As New ClsCompras(transaccion)
Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL())
If Not AddPrepolizaCabecera(ObjConta) Then
@@ -7122,14 +7883,15 @@ Public Class ClsCompraManager
If Not ObjCompras.UpdateCompraFactura(Me.CveCompra, Me.CveFactura, Me.Serie, Me.Folio) Then respuesta = False
End If
If respuesta Then
ObjCompras.Commit()
Else
ObjCompras.RollBack()
End If
ObjCompras.Dispose()
ObjConta.Dispose()
'If respuesta Then
' ObjCompras.Commit()
'Else
' ObjCompras.RollBack()
'End If
'ObjCompras.Dispose()
'ObjConta.Dispose()
Return respuesta
End Function

View File

@@ -103,6 +103,19 @@
</div>
<div class="portlet-body" <%= IIf(chkexpand.Checked = True, "", "style=""display:none;""")%>>
<div class="row">
<div class="col-md-1 truncate">
Tipo Movto
</div>
<div class="col-md-2 truncate">
<asp:DropDownList ID="DdlOpcionCuenta" runat="server" CssClass="form-control input-sm select2me" Width="100%">
<asp:ListItem Text="Todos" Value="-1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Sin Saldo" Value="1"></asp:ListItem>
<asp:ListItem Text="Con Saldo" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1 truncate">
<asp:Label ID="LblSubProyecto" runat="server" Text="Label"></asp:Label>
</div>

View File

@@ -146,7 +146,8 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
DTDatos = New DataTable
Dim Conta As New ClsContabilidad
If Conta.GetAnexoCatalagoCC(DdlCuentas.SelectedValue.ToEntero, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveUsuario) Then
If Conta.GetAnexoCatalagoCC(DdlCuentas.SelectedValue.ToEntero, txtFechaI.Text.ToDate, txtFechaF.Text.ToDate, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveUsuario,
OpcionCuentas:=DdlOpcionCuenta.SelectedValue.ToEntero) Then
DTHeaders = Conta.DSResultados.Tables(0)
DTDatos = Conta.DSResultados.Tables(1)
@@ -248,7 +249,7 @@ Partial Class Contabilidad2_RepAnexoCatalogoCC
End If
If Importe <> 0 Then
'' pendiente.. ' e.Row.Cells(Index).Text = $"<a { If(Importe < 0, "style='color:Red;'", "style='color:#337ab7;'") } target='_blank' href='./RepAnexoCatalogo.aspx?CveCuenta={CveCunetaRow}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={ If(DRow("CveSubProyecto").ToString.ToEntero > 0, DRow("CveSubProyecto").ToString, "-1")}' >{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }</a>"
e.Row.Cells(Index).Text = $"<a { If(Importe < 0, "style='color:Red;'", "style='color:#337ab7;'") } target='_blank' href='./RepMovimientosAuxiliaresCatalogo.aspx?CveCuenta={CveCunetaRow}&FF={txtFechaF.Text}&FI={txtFechaI.Text}&ER=1&CveSubProyecto={ If(DRow("CveSubProyecto").ToString.ToEntero > 0, DRow("CveSubProyecto").ToString, "-1")}' >{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }</a>"
End If
Index += 1

View File

@@ -581,7 +581,7 @@ Partial Class Inventarios_RecepcionAlmacen
''' </summary>
''' <param name="CveSubProyecto"></param>
''' <param name="CveTiposAlmacen">Parametro sin espacios y separado por comas ["1,2,3,21"]</param>
Private Sub CargaAlmacenes(CveSubProyecto As Integer, Optional CveTiposAlmacen As String = "", Optional CveTipoCompra As Integer = -1)
Private Sub CargaAlmacenes(CveSubProyecto As Integer, Optional CveTiposAlmacen As String = "", Optional CveTipoCompra As Integer = -1, Optional RecargaGrid As Boolean = True)
Dim StrAlmacenes As String = ""
Dim Strtmp As String = If(TipoMovimiento = 2, ",21", "") ' cuando es solicitud de devolución de almacen ,considerar los almacenes de dev prov
StrAlmacenes = $"CveTipoAlmacen IN ({If(CveTiposAlmacen.Length > 0, CveTiposAlmacen, "1,2,15,14,19" & Strtmp)}) {If(CveSubProyecto > 0, $"And CveSubProyecto = {CveSubProyecto}", "")}"
@@ -597,25 +597,20 @@ Partial Class Inventarios_RecepcionAlmacen
DdlAlmacen.DataBind()
If UsuarioActual.CveAlmacen > 0 Then
DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
RecargaporAlmacenes()
If RecargaGrid Then RecargaporAlmacenes()
End If
UpGenerales.Update()
End Sub
Private Sub RecargaporAlmacenes()
CveTipoAlmacen = -1
If DdlAlmacen.SelectedValue <> "-1" Then
Dim drr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero).FiltroPrimero("")
If drr IsNot Nothing Then
CveTipoAlmacen = drr("CveTipoAlmacen").ToString.ToEntero
End If
CargaGVInv()
'For Each Gvr As GridViewRow In GvInv.Rows
' If Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue = "-1" Then
@@ -1076,7 +1071,9 @@ Partial Class Inventarios_RecepcionAlmacen
If TipoMovimiento = 3 Then
CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero, "21", CveTipoCompra)
Else
CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero, "22", CveTipoCompra)
Dim tTipoAlm As String = "22"
If CveTipoCompra = 16 Then tTipoAlm = "22,1,24" ' apoyos, "acumuladores sin virtual" o "virtual solo"
CargaAlmacenes(DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero, tTipoAlm, CveTipoCompra, RecargaGrid:=False)
End If
Else
@@ -1096,11 +1093,7 @@ Partial Class Inventarios_RecepcionAlmacen
End If
End If
CveSubProyecto = DtRecepcion.Rows(0)("CveSubProyecto").ToString.ToEntero
CveAlmacenDevolucionProveedor = DtRecepcion.Rows(0)("CveAlmacenDevolucionProveedor").ToString.ToEntero
'SI ES MOTOBATERIA NO GENERA MOVIMIENTO VIRTUAL
@@ -1112,8 +1105,8 @@ Partial Class Inventarios_RecepcionAlmacen
DivVirtualAdvertencia.Visible = False
End If
'SI LA COMPRA ES DE TIPO "APOYO LOGISTICO" NO DEBE GENERAR VIRTUAL
If Not SumarImporteUsados AndAlso CveTipoCompra = 9 Then
'SI LA COMPRA ES DE TIPO "APOYO LOGISTICO" NO DEBE GENERAR VIRTUAL (9) y apoyo sin virtual (16)
If Not SumarImporteUsados AndAlso CveTipoCompra.Contiene(9, 16) Then
RealizarMovimientoVirtual = False
DivVirtualAdvertencia.Visible = False
End If
@@ -1447,6 +1440,7 @@ Partial Class Inventarios_RecepcionAlmacen
If UsuarioActual.CveEmpresa = 119 Then
DtInv = DtInv.FiltraParametros("", "PS")
End If
If Not DtInv.Columns.Contains("Consec") Then DtInv.Columns.Add("Consec", GetType(Integer))
Dim AplicaSeccion, AplicaLote, AplicaCaducidad, AplicaSerie As Boolean
If DtInv IsNot Nothing AndAlso DtInv.Rows.Count > 0 Then
@@ -1744,7 +1738,7 @@ Partial Class Inventarios_RecepcionAlmacen
Private Sub CreaDtDetalle()
If DtDatosDetalle Is Nothing Then
DtDatosDetalle = New DataTable
DtDatosDetalle.Columns.Add("Consec", GetType(Integer))
If Not DtDatosDetalle.Columns.Contains("Consec") Then DtDatosDetalle.Columns.Add("Consec", GetType(Integer))
DtDatosDetalle.Columns.Add("ConsecId", GetType(Integer))
DtDatosDetalle.Columns.Add("CvePS", GetType(Integer))
DtDatosDetalle.Columns.Add("CveUM", GetType(Integer))
@@ -1996,7 +1990,7 @@ Partial Class Inventarios_RecepcionAlmacen
Private Sub CreaDtLoteDetalle()
If DtDatosLoteDetalle Is Nothing Then
DtDatosLoteDetalle = New DataTable
DtDatosLoteDetalle.Columns.Add("Consec", GetType(Integer))
If Not DtDatosLoteDetalle.Columns.Contains("Consec") Then DtDatosLoteDetalle.Columns.Add("Consec", GetType(Integer))
DtDatosLoteDetalle.Columns.Add("ConsecId", GetType(Integer))
DtDatosLoteDetalle.Columns.Add("Cantidad", GetType(Decimal))
DtDatosLoteDetalle.Columns.Add("CvePS", GetType(Integer))

View File

@@ -2876,6 +2876,7 @@ Partial Class Ventas
TmpDT = ObjCGame.DtResultados
TmpDT.Columns.Add("Costo", GetType(Decimal))
TmpDT.Columns("Costo").DefaultValue = 0D
If Not TmpDT.Columns.Contains("NumeroParte") Then TmpDT.Columns.Add("NumeroParte", GetType(String))
GvPS.DataBind()
End If
@@ -17638,7 +17639,6 @@ Partial Class Ventas
Dim Folio = GvRowAnticipo.DataKey("Folio")
Dim Tipo = GvRowAnticipo.DataKey("Tipo")
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo)
End If
@@ -17768,7 +17768,7 @@ Partial Class Ventas
Select Case gvr.DataKey("CveConceptoContable").ToString()
Case "3", "295"
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DdlMoneda.SelectedValue.ToEntero() = 1 Then
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
Dim ImporteNC As Decimal = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
Dim RespNC = GenerarNC(ImporteNC, DdlVendedor.SelectedValue.ToEntero(), Me.VentaActual, gvr, ObjVenta)