eFacturas
This commit is contained in:
@@ -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>
|
||||
</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">×</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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user