mejoras en fluctuaciones

This commit is contained in:
2022-02-15 11:36:58 -07:00
parent a6fda1dee5
commit 0683951c4a
2 changed files with 911 additions and 296 deletions

View File

@@ -155,8 +155,7 @@
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<br />
<asp:UpdatePanel ID="UpTabs" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<ajax:TabContainer runat="server" ID="T">
@@ -219,11 +218,8 @@
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<div class="row">
<br />
<div class="row">
<div class="col-md-5 form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtConceptoCompras" Style="text-transform: uppercase;" runat="server" MaxLength="100" CssClass="form-control marginFixRow" Width="96%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtConceptoCompras" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtConceptoCompras"
@@ -245,11 +241,9 @@
<asp:Button Text="Generar Proveedores" runat="server" ID="BtnGeneraCompras" Visible="false" OnClick="BtnGeneraCompras_Click" Style="margin-left: 30px;" class="btn btn-primary" ValidationGroup="GrpGuardarCompras" />
<asp:HiddenField ID="HdnProveedorCvePrePoliza" runat="server" />
<asp:Button ID="BtnProveedoresRemove" runat="server" Text="Eliminar" Visible="false" OnClick="BtnProveedoresRemove_Click" class="btn btn-primary" /></div>
</div>
</div>
<br />
<asp:GridView ID="GvCompras" Width="99%" runat="server" AutoGenerateColumns="False"
<asp:GridView ID="GvProveedores" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveCompra,CveProveedor,TipoCambio, Fluctuacion,SerieFolio, CveConceptoContable,FluctuacionTotal,PerdidaGanancia,IdCtaContComplementaria,CveIE"
EmptyDataText="No se Encontraron compras pendientes de pagar." ToolTip="Listado de Compras"
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
@@ -266,6 +260,108 @@
<%--<asp:Label ID="LblTotalCompras" runat="server" Text=""></asp:Label>--%>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabComprasAnt" HeaderText="Proveedores Ant">
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server" Visible="False">
<ContentTemplate>
<div id="Div1" visible="true" class="row" runat="server">
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="widget-thumb text-uppercase bordered">
<h4 class="widget-thumb-heading">PÉRDIDA</h4>
<div class="widget-thumb-wrap">
<i class="widget-thumb-icon bg-red fa fa-money"></i>
<div class="widget-thumb-body">
<span class="widget-thumb-subtitle">MXN</span>
<span class="widget-thumb-body-stat">
<asp:Literal ID="Literal1" Text="" runat="server" />
</span>
</div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="widget-thumb text-uppercase bordered">
<h4 class="widget-thumb-heading">GANANCIA</h4>
<div class="widget-thumb-wrap">
<i class="widget-thumb-icon bg-green fa fa-money"></i>
<div class="widget-thumb-body">
<div class="row">
<div class="col-md-6">
<span class="widget-thumb-subtitle">MXN</span>
<span class="widget-thumb-body-stat">
<asp:Literal ID="Literal2" Text="" runat="server" />
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="widget-thumb text-uppercase bordered">
<h4 class="widget-thumb-heading">
<asp:Label ID="Label3" runat="server" Text=""></asp:Label></h4>
<div class="widget-thumb-wrap">
<i id="I1" runat="server" class=""></i>
<div class="widget-thumb-body">
<div class="row">
<div class="col-md-6">
<span class="widget-thumb-subtitle">MXN</span>
<span class="widget-thumb-body-stat">
<asp:Literal ID="Literal3" Text="" runat="server" />
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<div class="row">
<div class="col-md-5 form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtConceptoComprasAnt" Style="text-transform: uppercase;" runat="server" MaxLength="100" CssClass="form-control marginFixRow" Width="96%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtConceptoComprasAnt" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtConceptoComprasAnt"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarComprasAnt"></asp:RequiredFieldValidator>
<label for="<%= TxtConceptoComprasAnt.ClientID.ToString()%>">Concepto:</label>
<i></i>
</div>
<div class="col-md-2 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoComprasAnt" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubProyectoComprasAnt.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoComprasAnt"></asp:Label></label>
<asp:RequiredFieldValidator ID="RFVDdlSubProyectoComprasAnt" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubProyectoComprasAnt" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarComprasAnt"></asp:RequiredFieldValidator>
<i></i>
</div>
<div class="col-md-2" style="text-align: right!important">
<asp:Button Text="Generar Proveedores Ant" runat="server" ID="BtnGeneraComprasAnt" Visible="false" OnClick="BtnGeneraComprasAnt_Click" Style="margin-left: 30px;" class="btn btn-primary" ValidationGroup="GrpGuardarComprasAnt" />
<asp:HiddenField ID="HdnProveedorAntCvePrePoliza" runat="server" />
<asp:Button ID="BtnProveedoresAntRemove" runat="server" Text="Eliminar" Visible="false" OnClick="BtnProveedoresAntRemove_Click" class="btn btn-primary" /></div>
</div>
<br />
<asp:GridView ID="GvProveedoresAnt" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveCompra,CveProveedor,TipoCambio, Fluctuacion,SerieFolio, CveConceptoContable,FluctuacionTotal,PerdidaGanancia,IdCtaContComplementaria,CveIE"
EmptyDataText="No se Encontraron compras pendientes de pagar." ToolTip="Listado de Compras"
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField HeaderText="Proveedor" DataTextField="NombreComercial" Target="_blank" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataNavigateUrlFields="CveProveedor" />
<asp:HyperLinkField HeaderText="# Facturas" DataTextField="SerieFolio" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" DataNavigateUrlFields="CveCompra"/>
<asp:BoundField DataField="TipoDocto" HeaderText="Tipo" />
<asp:BoundField DataField="TipoCambio" HeaderText="TipoCambio" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Saldo USD" DataField="Saldo" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Fluctuación Pesos" DataField="FluctuacionTotal" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Perdida o Ganancia" DataField="PerdidaGanancia" ItemStyle-Width="100" />
</Columns>
</asp:GridView>
<%--<asp:Label ID="LblTotalCompras" runat="server" Text=""></asp:Label>--%>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabVentas" HeaderText="Clientes">
<ContentTemplate>
<asp:UpdatePanel ID="UpIndicadoresVentas" UpdateMode="Conditional" runat="server" Visible="false">
@@ -349,7 +445,7 @@
<i></i>
</div>
<div class="col-md-6" style="text-align: right!important">
<div class="col-md-3" style="text-align: right!important">
<asp:Button Text="Generar Ventas" runat="server" ID="BtnGeneraVentas" Visible="false" OnClick="BtnGeneraVentas_Click" Style="margin-left: 30px;" class="btn btn-primary" ValidationGroup="GrpGuardarVentas" />
<asp:HiddenField ID="HdnClienteCvePrePoliza" runat="server" />
<asp:Button ID="BtnClientesRemove" runat="server" Text="Eliminar" Visible="false" OnClick="BtnClientesRemove_Click" class="btn btn-primary" /></div>
@@ -376,7 +472,218 @@
<asp:Label ID="LblTotalVentas" runat="server" Text=""></asp:Label>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabCuentasBancarias" HeaderText="Cuentas Bancarias">
<ajax:TabPanel runat="server" ID="TabVentasAnt" HeaderText="Clientes Ant">
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server" Visible="false">
<ContentTemplate>
<div id="Div2" visible="true" class="row" runat="server">
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="widget-thumb text-uppercase bordered">
<h4 class="widget-thumb-heading">PÉRDIDA</h4>
<div class="widget-thumb-wrap">
<i class="widget-thumb-icon bg-red fa fa-money"></i>
<div class="widget-thumb-body">
<span class="widget-thumb-subtitle">MXN</span>
<span class="widget-thumb-body-stat">
<asp:Literal ID="Literal4" Text="" runat="server" />
</span>
</div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="widget-thumb text-uppercase bordered">
<h4 class="widget-thumb-heading">GANANCIA</h4>
<div class="widget-thumb-wrap">
<i class="widget-thumb-icon bg-green fa fa-money"></i>
<div class="widget-thumb-body">
<div class="row">
<div class="col-md-6">
<span class="widget-thumb-subtitle">MXN</span>
<span class="widget-thumb-body-stat">
<asp:Literal ID="Literal5" Text="" runat="server" />
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="widget-thumb text-uppercase bordered">
<h4 class="widget-thumb-heading">
<asp:Label ID="Label5" runat="server" Text=""></asp:Label></h4>
<div class="widget-thumb-wrap">
<i id="I2" runat="server" class=""></i>
<div class="widget-thumb-body">
<div class="row">
<div class="col-md-6">
<span class="widget-thumb-subtitle">MXN</span>
<span class="widget-thumb-body-stat">
<asp:Literal ID="Literal6" Text="" runat="server" />
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<div class="row">
<div class="col-md-5 form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtConceptoVentasAnt" Style="text-transform: uppercase;" runat="server" MaxLength="100" CssClass="form-control " Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtConceptoVentasAnt"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarVentasAnt"></asp:RequiredFieldValidator>
<label for="<%= TxtConceptoVentasAnt.ClientID.ToString()%>">Concepto:</label>
<i></i>
</div>
<div class="col-md-2 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlsubProyectoVentasAnt" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlsubProyectoVentasAnt.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoVentasAnt"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlsubProyectoVentasAnt" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarVentasAnt"></asp:RequiredFieldValidator>
<i></i>
</div>
<div class="col-md-3" style="text-align: right!important">
<asp:Button Text="Generar Clientes Anticipos" runat="server" ID="BtnClientesAnticipos" Visible="false" OnClick="BtnClientesAnticipos_Click" Style="margin-left: 30px;" class="btn btn-primary" ValidationGroup="GrpGuardarVentasAnt" />
<asp:HiddenField ID="HdnClienteAntCvePrePoliza" runat="server" />
<asp:Button ID="BtnClientesAntRemove" runat="server" Text="Eliminar" Visible="false" OnClick="BtnClientesAntRemove_Click" class="btn btn-primary" /></div>
</div>
<br />
<asp:GridView ID="GvClientesAnt" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="TipoCambio,Fluctuacion,CveVenta,SerieFolio,CveIE,IdCtaContComplementaria,TipoDocto" EmptyDataText="No se Encontraron Cuentas Bancarias."
ToolTip="Listado de Cuentas Bancarias" CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField DataTextField="Nombre" HeaderText="Cliente" Target="_blank" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" DataNavigateUrlFields="CveCliente" />
<asp:HyperLinkField DataTextField="SerieFolio" HeaderText="SerieFolio" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataNavigateUrlFields="CveVenta" />
<asp:BoundField DataField="Fecha" HeaderText="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="TipoDocto" HeaderText="Tipo" />
<asp:BoundField DataField="TipoCambio" HeaderText="TipoCambio" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Saldo" HeaderText="Saldo" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Diferencia" HeaderText="Diferencia TC" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:N4}" />
<asp:BoundField DataField="FluctuacionPesos" HeaderText="Fluctuacion Pesos" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PerdidaGanancia" HeaderText="Acción" ItemStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
<asp:Label ID="LblTotalVentasAnt" runat="server" Text=""></asp:Label>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabAcreedores" HeaderText="Compras Acreedores">
<ContentTemplate>
<div class="row">
<div class="col-md-5 form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtConceptoAcreedores" Style="text-transform: uppercase;" runat="server" MaxLength="100" CssClass="form-control " Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtConceptoAcreedores" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtConceptoAcreedores"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarAcreedores"></asp:RequiredFieldValidator>
<label for="<%= TxtConceptoAcreedores.ClientID.ToString()%>">Concepto:</label>
<i></i>
</div>
<div class="col-md-2 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoAcreedores" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubProyectoAcreedores.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoAcreedores"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RFVDdlSubProyectoAcreedores" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubProyectoAcreedores" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarAcreedores"></asp:RequiredFieldValidator>
<i></i>
</div>
<div class="col-md-3" style="text-align: right!important">
<asp:Button Text="Generar Acreedores" runat="server" ID="BtnGeneraAcreedores" Visible="false" OnClick="BtnGeneraAcreedores_Click" Style="margin-left: 30px;" class="btn btn-primary" ValidationGroup="GrpGuardarAcreedores" />
<asp:HiddenField ID="HdnAcreedorCvePrePoliza" runat="server" />
<asp:Button ID="BtnAcreedoresRemove" runat="server" Text="Eliminar" Visible="false" OnClick="BtnAcreedoresRemove_Click" class="btn btn-primary" />
</div>
</div>
<br />
<asp:GridView ID="GvAcreedores" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveCompra,CveProveedor,TipoCambio,Fluctuacion,SerieFolio,IdCtaContComplementaria,CveIE"
EmptyDataText="No se Encontraron compras pendientes de pagar." ToolTip="Listado de Compras"
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField HeaderText="Proveedor" DataTextField="NombreComercial" Target="_blank" ItemStyle-HorizontalAlign="Left" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataNavigateUrlFields="CveProveedor" />
<asp:HyperLinkField HeaderText="# Facturas" DataTextField="SerieFolio" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" DataNavigateUrlFields="CveCompra"/>
<asp:BoundField DataField="TipoCambio" HeaderText="TipoCambio" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Saldo USD" DataField="Saldo" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Fluctuación Pesos" DataField="Fluctuacion" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PerdidaGanancia" HeaderText="Acción" ItemStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
<asp:Label ID="LblTotalAcreedores" runat="server" Text=""></asp:Label>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabAcreedoresAnticipos" HeaderText="Acreedores Ant">
<ContentTemplate>
<div class="row">
<div class="col-md-5 form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtConceptoAcreedoresAnt" Style="text-transform: uppercase;" runat="server" MaxLength="100" CssClass="form-control " Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVConceptoAcreedoresAnt" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtConceptoAcreedoresAnt"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarAcreedoresAnt"></asp:RequiredFieldValidator>
<label for="<%= TxtConceptoAcreedoresAnt.ClientID.ToString()%>">Concepto:</label>
<i></i>
</div>
<div class="col-md-2 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoAcreeedoresAnt" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubProyectoAcreeedoresAnt.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoAcreedoresAnt"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubProyectoAcreeedoresAnt" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarAcreedoresAnt"></asp:RequiredFieldValidator>
<i></i>
</div>
<div class="col-md-3" style="text-align: right!important">
<asp:Button Text="Generar Acreedores Ant" runat="server" ID="BtnGeneraAcreedoresAnt" Visible="false" OnClick="BtnGeneraAcreedoresAnt_Click" Style="margin-left: 30px;" class="btn btn-primary" ValidationGroup="GrpGuardarAcreedoresAnt" />
<asp:HiddenField ID="HdnAcreedorAntCvePrePoliza" runat="server" />
<asp:Button ID="BtnAcreedoresAntRemove" runat="server" Text="Eliminar" Visible="false" OnClick="BtnAcreedoresAntRemove_Click" class="btn btn-primary" />
</div>
</div>
<br />
<asp:GridView ID="GvAcreedoresAnt" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveCompra,CveProveedor,TipoCambio,Fluctuacion,SerieFolio,IdCtaContComplementaria,CveIE"
EmptyDataText="No se Encontraron compras pendientes de pagar." ToolTip="Listado de Compras"
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField HeaderText="Proveedor" DataTextField="NombreComercial" Target="_blank" ItemStyle-HorizontalAlign="Left" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataNavigateUrlFields="CveProveedor" />
<asp:HyperLinkField HeaderText="# Facturas" DataTextField="SerieFolio" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" DataNavigateUrlFields="CveCompra"/>
<asp:BoundField DataField="TipoCambio" HeaderText="TipoCambio" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Saldo USD" DataField="Saldo" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Fluctuación Pesos" DataField="Fluctuacion" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PerdidaGanancia" HeaderText="Acción" ItemStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
<asp:Label ID="LblTotalAcreedoresAnt" runat="server" Text=""></asp:Label>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabCuentasBancarias" HeaderText="Cuentas Bancarias">
<ContentTemplate>
<br />
<div class="row">
@@ -426,105 +733,7 @@
<asp:Label ID="LblTotalBancos" runat="server" Text=""></asp:Label>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabDeudores" HeaderText="Deudores">
<ContentTemplate>
<div class="row">
<div class="col-md-5 form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtConceptoDeudores" Style="text-transform: uppercase;" runat="server" MaxLength="100" CssClass="form-control " Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtConceptoDeudores" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtConceptoDeudores"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarDeudores"></asp:RequiredFieldValidator>
<label for="<%= TxtConceptoDeudores.ClientID.ToString()%>">Concepto:</label>
<i></i>
</div>
<div class="col-md-2 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoDeudores" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubProyectoDeudores.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoDeudores"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RFVRFVDdlSubProyectoDeudores" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubProyectoDeudores" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarDeudores"></asp:RequiredFieldValidator>
<i></i>
</div>
<div class="col-md-6" style="text-align: right!important">
<asp:Button Text="Generar Deudores" runat="server" ID="BtnGeneraDedudores" OnClick="BtnGeneraDedudores_Click" Style="margin-left: 30px;" class="btn btn-primary" ValidationGroup="GrpGuardarDeudores" />
</div>
</div>
<br />
<asp:GridView ID="GvDeudores" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="IdCtaAfectable,TipoCambio,Fluctuacion,RazonSocial,CveIE"
EmptyDataText="No se Encontraron Cuentas Bancarias." ToolTip="Listado de Cuentas Bancarias"
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Deudor" DataField="RazonSocial" ItemStyle-Width="250" ItemStyle-HorizontalAlign="Left" />
<asp:HyperLinkField HeaderText="Folio" DataTextField="Folio" DataNavigateUrlFields="CveIE" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Importe" DataField="Importe" ItemStyle-Width="100" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TipoCambio" HeaderText="TipoCambio" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Saldo" DataField="Saldo" ItemStyle-Width="100" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="T.C. último ajuste" DataField="TipoCambio" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Fluctuación" DataField="Fluctuacion" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
</Columns>
</asp:GridView>
<asp:Label ID="LblTotalDeudores" runat="server" Text=""></asp:Label>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabAcreedores" HeaderText="Compras Acreedores">
<ContentTemplate>
<br />
<div class="row">
<div class="col-md-5 form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtConceptoAcreedores" Style="text-transform: uppercase;" runat="server" MaxLength="100" CssClass="form-control " Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtConceptoAcreedores" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtConceptoAcreedores"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarAcreedores"></asp:RequiredFieldValidator>
<label for="<%= TxtConceptoAcreedores.ClientID.ToString()%>">Concepto:</label>
<i></i>
</div>
<div class="col-md-2 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoAcreedores" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubProyectoAcreedores.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoAcreedores"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RFVDdlSubProyectoAcreedores" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubProyectoAcreedores" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarAcreedores"></asp:RequiredFieldValidator>
<i></i>
</div>
<div class="col-md-3" style="text-align: right!important">
<asp:Button Text="Generar Acreedores" runat="server" ID="BtnGeneraAcreedores" Visible="false" OnClick="BtnGeneraAcreedores_Click" Style="margin-left: 30px;" class="btn btn-primary" ValidationGroup="GrpGuardarAcreedores" />
<asp:HiddenField ID="HdnAcreedorCvePrePoliza" runat="server" />
<asp:Button ID="BtnAcreedoresRemove" runat="server" Text="Eliminar" Visible="false" OnClick="BtnAcreedoresRemove_Click" class="btn btn-primary" />
</div>
</div>
<br />
<asp:GridView ID="GvAcreedores" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveCompra,CveProveedor,TipoCambio,Fluctuacion,SerieFolio,IdCtaContComplementaria,CveIE"
EmptyDataText="No se Encontraron compras pendientes de pagar." ToolTip="Listado de Compras"
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField HeaderText="Proveedor" DataTextField="NombreComercial" Target="_blank" ItemStyle-HorizontalAlign="Left" DataNavigateUrlFormatString="/Compras/Proveedores.aspx?CveProveedor={0}" DataNavigateUrlFields="CveProveedor" />
<asp:HyperLinkField HeaderText="# Facturas" DataTextField="SerieFolio" Target="_blank" DataNavigateUrlFormatString="/Compras/Compras.aspx?CveCompra={0}" DataNavigateUrlFields="CveCompra"/>
<asp:BoundField DataField="TipoCambio" HeaderText="TipoCambio" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Saldo USD" DataField="Saldo" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Fluctuación Pesos" DataField="Fluctuacion" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="PerdidaGanancia" HeaderText="Acción" ItemStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
<asp:Label ID="LblTotalAcreedores" runat="server" Text=""></asp:Label>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabFilial" HeaderText="Filial">
<ContentTemplate>
@@ -575,6 +784,54 @@
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="TabDeudores" HeaderText="Deudores">
<ContentTemplate>
<div class="row">
<div class="col-md-5 form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtConceptoDeudores" Style="text-transform: uppercase;" runat="server" MaxLength="100" CssClass="form-control " Width="90%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtConceptoDeudores" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtConceptoDeudores"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardarDeudores"></asp:RequiredFieldValidator>
<label for="<%= TxtConceptoDeudores.ClientID.ToString()%>">Concepto:</label>
<i></i>
</div>
<div class="col-md-2 form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlSubProyectoDeudores" runat="server" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me js-referencia-programmatic marginFixRow" Width="90%">
</asp:DropDownList>
<label for="<%= DdlSubProyectoDeudores.ClientID.ToString()%>">
<asp:Label runat="server" ID="LblSubProyectoDeudores"></asp:Label>
</label>
<asp:RequiredFieldValidator ID="RFVRFVDdlSubProyectoDeudores" runat="server" CssClass="help-block errorimput" InitialValue="-1" ControlToValidate="DdlSubProyectoDeudores" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo es necesario, por favor ingréselo." ValidationGroup="GrpGuardarDeudores"></asp:RequiredFieldValidator>
<i></i>
</div>
<div class="col-md-6" style="text-align: right!important">
<asp:Button Text="Generar Deudores" runat="server" ID="BtnGeneraDedudores" OnClick="BtnGeneraDedudores_Click" Style="margin-left: 30px;" class="btn btn-primary" ValidationGroup="GrpGuardarDeudores" />
</div>
</div>
<br />
<asp:GridView ID="GvDeudores" Width="99%" runat="server" AutoGenerateColumns="False"
DataKeyNames="IdCtaAfectable,TipoCambio,Fluctuacion,RazonSocial,CveIE"
EmptyDataText="No se Encontraron Cuentas Bancarias." ToolTip="Listado de Cuentas Bancarias"
CssClass="table table-hover table-striped ScrollAD mysmallbtn" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Deudor" DataField="RazonSocial" ItemStyle-Width="250" ItemStyle-HorizontalAlign="Left" />
<asp:HyperLinkField HeaderText="Folio" DataTextField="Folio" DataNavigateUrlFields="CveIE" DataNavigateUrlFormatString="/Bancos/IE.aspx?CveIE={0}" ItemStyle-Width="150" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Importe" DataField="Importe" ItemStyle-Width="100" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="TipoCambio" HeaderText="TipoCambio" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Saldo" DataField="Saldo" ItemStyle-Width="100" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="T.C. último ajuste" DataField="TipoCambio" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Fluctuación" DataField="Fluctuacion" DataFormatString="{0:N2}" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right" />
</Columns>
</asp:GridView>
<asp:Label ID="LblTotalDeudores" runat="server" Text=""></asp:Label>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>

View File

@@ -28,11 +28,14 @@ Partial Class Bancos_FluctuacionCambiaria
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
CargaFechas()
CargarCentrosDeCosto(Nothing, DdlSubProyectoCompras, Nothing, LblSubProyectoCompras, "")
CargarCentrosDeCosto(Nothing, DdlSubProyectoComprasAnt, Nothing, LblSubProyectoComprasAnt, "")
CargarCentrosDeCosto(Nothing, DdlsubProyectoVentas, Nothing, LblSubProyectoVentas, "")
CargarCentrosDeCosto(Nothing, DdlsubProyectoVentasAnt, Nothing, LblSubProyectoVentasAnt, "")
CargarCentrosDeCosto(Nothing, DdlSubProyectoAcreedores, Nothing, LblSubProyectoAcreedores, "")
CargarCentrosDeCosto(Nothing, DdlSubProyectoAcreeedoresAnt, Nothing, LblSubProyectoAcreedoresAnt, "")
CargarCentrosDeCosto(Nothing, DdlSubproyectoBancos, Nothing, LblSubProyectoBancos, "")
CargarCentrosDeCosto(Nothing, DdlsubProyectoVentas, Nothing, LblSubProyectoVentas, "")
CargarCentrosDeCosto(Nothing, DdlSubProyectoCompras, Nothing, LblSubProyectoCompras, "")
CargarCentrosDeCosto(Nothing, DdlSubProyectoFiliales, Nothing, LblSubProyectoFiliales, "")
CargarCentrosDeCosto(Nothing, DdlSubProyectoAcreedores, Nothing, LblSubProyectoAcreedores, "")
CargarCentrosDeCosto(Nothing, DdlSubProyectoFiliales, Nothing, LblSubProyectoFiliales, "")
CargarCentrosDeCosto(Nothing, DdlSubProyectoDeudores, Nothing, LblSubProyectoDeudores, "")
CargaUltimaFluctuacion()
@@ -62,14 +65,18 @@ Partial Class Bancos_FluctuacionCambiaria
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
CargaTipoCambio()
If T.ActiveTabIndex = 0 Then CargaDatosCompra()
If T.ActiveTabIndex = 1 Then CargaDatosVentas()
If T.ActiveTabIndex = 2 Then CargaDatosCuentas()
If T.ActiveTabIndex = 3 Then CargaDatosDeudores()
If T.ActiveTabIndex = 4 Then CargaDatosAcreedores()
If T.ActiveTabIndex = 5 Then CargaDatosFiliales()
If T.ActiveTabIndex = 0 Then CargaDatosProveedores()
If T.ActiveTabIndex = 1 Then CargaDatosProveedoresAnticipos()
If T.ActiveTabIndex = 2 Then CargaDatosClientes()
If T.ActiveTabIndex = 3 Then CargaDatosClientesAnticipos()
If T.ActiveTabIndex = 4 Then CargaDatosAcreedores()
If T.ActiveTabIndex = 5 Then CargaDatosAcreedoresAnticipos()
If T.ActiveTabIndex = 6 Then CargaDatosCuentas()
If T.ActiveTabIndex = 7 Then CargaDatosFiliales()
If T.ActiveTabIndex = 8 Then CargaDatosDeudores()
UpTabs.Update()
End Sub
@@ -84,21 +91,8 @@ Partial Class Bancos_FluctuacionCambiaria
ObjGenerales.Dispose()
End Sub
Private Sub CargaUltimaFluctuacion()
'Dim Obj As New ClsBancos
'If Obj.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then
' Dim dt As DataTable = Obj.DtResultados.FiltraParametros("TipoFluctuacion = 1", "Fecha DESC")
' If dt.Rows.Count > 0 Then
' LtlUltimaFluctuacion.Text = String.Format("Ultima Fluctuación : {0}", dt.Rows(0)("Fecha").ToString.ToDate.ToShortDateString)
' 'si la ultima fluctuacion es mayor o igual al fin de mes anterior, entonces pon la fecha actual
' If dt.Rows(0)("Fecha").ToString.ToDate >= Now.AddMonths(-1).LastDayOfMonth Then
' TxtFecha.Text = Now.ToShortDateString
' Else
' TxtFecha.Text = Now.AddMonths(-1).LastDayOfMonth.ToShortDateString()
' End If
' End If
'End If
'Obj.Dispose()
Private Sub CargaUltimaFluctuacion()
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(Now)
@@ -111,24 +105,23 @@ Partial Class Bancos_FluctuacionCambiaria
Else
DdlMes.SelectedValueExist(Now.AddMonths(-1).Month)
DdlAnio.SelectedValueExist(Now.AddMonths(-1).Year)
'TxtFecha.Text = Now.AddMonths(-1).LastDayOfMonth.ToShortDateString()
End If
End If
CargaTipoCambio()
End Sub
Private Sub CargaDatosCompra()
Dim ObjBancos As New ClsBancos
'LblTotalCompras.Text = "0.00"
Private Sub CargaDatosProveedores()
Dim ObjBancos As New ClsBancos
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 1, UsuarioActual.CveEmpresa) Then
GvCompras.DataSource = ObjBancos.DtResultados
GvProveedores.DataSource = ObjBancos.DtResultados
'LblTotalCompras.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0 ")
Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0 ")
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0 ")
Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0 ")
Dim PerdidaAux As Double = Perdida.SUM("Fluctuacion").Abs
Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion")
Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion").Abs
Dim Final As Double = GanaciaAux - PerdidaAux
HdnProveedorCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString
@@ -138,6 +131,44 @@ Partial Class Bancos_FluctuacionCambiaria
IImagenResultado.Attributes("class") = If(Final > 0, "widget-thumb-icon bg-green-jungle fa fa-usd", "widget-thumb-icon bg-red fa fa-usd")
LtIndicador_ExistenciaPerdida.Text = PerdidaAux.ToString.FormatoNumero
LtIndicador_ValorPesosGanancia.Text = GanaciaAux.ToString.FormatoNumero
LtIndicador_CPPesosFinal.Text = Final.Abs.ToString.FormatoNumero
LblComprasPerdidaGanancia.Text = If(Final < 0, "Ganancia", "Pérdida")
LblTotal = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
Else
GvProveedores.DataSource = Nothing
Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia)
End If
ObjBancos.Dispose()
GvProveedores.DataBind()
UpIndicadores.Visible = True
If GvProveedores.Rows.Count > 0 Then
GvProveedores.Rows(GvProveedores.Rows.Count - 1).CssClass = "SubTotales2"
End If
End Sub
Private Sub CargaDatosProveedoresAnticipos()
Dim ObjBancos As New ClsBancos
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 2, UsuarioActual.CveEmpresa) Then
GvProveedoresAnt.DataSource = ObjBancos.DtResultados
'LblTotalCompras.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0 ")
Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0 ")
Dim PerdidaAux As Double = Perdida.SUM("Fluctuacion").Abs
Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion")
Dim Final As Double = GanaciaAux - PerdidaAux
HdnProveedorAntCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString
HdnCveFluctuacionBitacora.Value = ObjBancos.DtResultados.MAX("CveFluctuacionBitacora").ToString
BtnProveedoresAntRemove.Visible = HdnProveedorAntCvePrePoliza.Value.ToEntero > 0
BtnGeneraComprasAnt.Visible = Not HdnProveedorAntCvePrePoliza.Value.ToEntero > 0
IImagenResultado.Attributes("class") = If(Final > 0, "widget-thumb-icon bg-green-jungle fa fa-usd", "widget-thumb-icon bg-red fa fa-usd")
LtIndicador_ExistenciaPerdida.Text = PerdidaAux.ToString.FormatoNumero
LtIndicador_ValorPesosGanancia.Text = GanaciaAux.ToString.FormatoNumero
LtIndicador_CPPesosFinal.Text = Final.Abs.ToString.FormatoNumero
@@ -145,28 +176,26 @@ Partial Class Bancos_FluctuacionCambiaria
LblTotal = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
Else
GvCompras.DataSource = Nothing
GvProveedoresAnt.DataSource = Nothing
Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia)
End If
ObjBancos.Dispose()
GvCompras.DataBind()
UpIndicadores.Visible = True
If GvCompras.Rows.Count > 0 Then
GvCompras.Rows(GvCompras.Rows.Count - 1).CssClass = "SubTotales2"
End If
GvProveedoresAnt.DataBind()
UpIndicadores.Visible = True
End Sub
Private Sub CargaDatosVentas()
Private Sub CargaDatosClientes()
Dim ObjBancos As New ClsBancos
LblTotalVentas.Text = "0.00"
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 2, UsuarioActual.CveEmpresa) Then
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 3, UsuarioActual.CveEmpresa) Then
GvVentas.DataSource = ObjBancos.DtResultados
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0")
Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0")
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0")
Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0")
Dim PerdidaAux As Double = Perdida.SUM("Fluctuacion", "Fluctuacion < 0").Abs
Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion", "Fluctuacion > 0")
Dim PerdidaAux As Double = Perdida.SUM("Fluctuacion", "Fluctuacion > 0").Abs
Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion", "Fluctuacion < 0").Abs
Dim Final As Double = GanaciaAux - PerdidaAux
HdnClienteCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString
@@ -190,12 +219,84 @@ Partial Class Bancos_FluctuacionCambiaria
End If
ObjBancos.Dispose()
GvVentas.DataBind()
End Sub
Private Sub CargaDatosClientesAnticipos()
Dim ObjBancos As New ClsBancos
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 4, UsuarioActual.CveEmpresa) Then
GvClientesAnt.DataSource = ObjBancos.DtResultados
Dim Perdida As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion < 0")
Dim Ganancias As DataTable = ObjBancos.DtResultados.FiltraParametros("Fluctuacion > 0")
Dim PerdidaAux As Double = Perdida.SUM("Fluctuacion", "Fluctuacion < 0").Abs
Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion", "Fluctuacion > 0")
Dim Final As Double = GanaciaAux - PerdidaAux
HdnClienteAntCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString
HdnCveFluctuacionBitacora.Value = ObjBancos.DtResultados.MAX("CveFluctuacionBitacora").ToString
BtnClientesAntRemove.Visible = HdnClienteAntCvePrePoliza.Value.ToEntero > 0
BtnClientesAnticipos.Visible = Not HdnClienteAntCvePrePoliza.Value.ToEntero > 0
'IImagenFinalVentas.Attributes("class") = If(Final > 0, "widget-thumb-icon bg-green-jungle fa fa-usd", "widget-thumb-icon bg-red fa fa-usd")
'LtIndicador_PerdidasVentas.Text = PerdidaAux.ToString.FormatoNumero
'LtIndicador_GanaciaVentas.Text = GanaciaAux.ToString.FormatoNumero
'LtIndicador_FinalVentas.Text = Final.ToString.FormatoNumero
'LblVentasPerdidaGanancia.Text = If(Final < 0, "Pérdida", "Ganancia")
LblTotalVentasAnt.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
UpIndicadoresVentas.Visible = True
Else
GvClientesAnt.DataSource = Nothing
Alert("Ocurrio un error al cargar las compras", TipoMensaje.MsgAdvertencia)
End If
ObjBancos.Dispose()
GvClientesAnt.DataBind()
End Sub
Private Sub CargaDatosAcreedores()
Dim ObjBancos As New ClsBancos
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 5, UsuarioActual.CveEmpresa) Then
HdnCveFluctuacionBitacora.Value = ObjBancos.DtResultados.MAX("CveFluctuacionBitacora").ToString
HdnAcreedorCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString
BtnAcreedoresRemove.Visible = HdnAcreedorCvePrePoliza.Value.ToEntero > 0
BtnGeneraAcreedores.Visible = Not HdnAcreedorCvePrePoliza.Value.ToEntero > 0
GvAcreedores.DataSource = ObjBancos.DtResultados
LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
Else
GvAcreedoresAnt.DataSource = Nothing
Alert("Ocurrio un error al cargar los acreedores", TipoMensaje.MsgAdvertencia)
End If
ObjBancos.Dispose()
GvAcreedores.DataBind()
End Sub
Private Sub CargaDatosAcreedoresAnticipos()
Dim ObjBancos As New ClsBancos
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 6, UsuarioActual.CveEmpresa) Then
HdnAcreedorAntCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString
BtnAcreedoresAntRemove.Visible = HdnAcreedorAntCvePrePoliza.Value.ToEntero > 0
BtnGeneraAcreedoresAnt.Visible = Not HdnAcreedorAntCvePrePoliza.Value.ToEntero > 0
GvAcreedoresAnt.DataSource = ObjBancos.DtResultados
LblTotalAcreedoresAnt.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
Else
GvAcreedoresAnt.DataSource = Nothing
Alert("Ocurrio un error al cargar los acreedores", TipoMensaje.MsgAdvertencia)
End If
ObjBancos.Dispose()
GvAcreedoresAnt.DataBind()
End Sub
Private Sub CargaDatosCuentas()
Dim ObjBancos As New ClsBancos
LblTotalBancos.Text = "0.00"
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 4, UsuarioActual.CveEmpresa) Then
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 7, UsuarioActual.CveEmpresa) Then
Dim DtTemp As DataTable = ObjBancos.DtResultados.Copy
Dim TCCierreFluctuacion As Decimal = LtTipoCambioActual.Text.ToDecimal
Dim TotAcumulado As Decimal = 0
@@ -237,7 +338,7 @@ Partial Class Bancos_FluctuacionCambiaria
End If
ObjBancos.Dispose()
GvCuentas.DataBind()
End Sub
End Sub
Private Sub CargaDatosDeudores()
Dim ObjBancos As New ClsBancos
@@ -253,24 +354,6 @@ Partial Class Bancos_FluctuacionCambiaria
GvDeudores.DataBind()
End Sub
Private Sub CargaDatosAcreedores()
Dim ObjBancos As New ClsBancos
LblTotalAcreedores.Text = "0.00"
If ObjBancos.GetFluctuaciones(FechaUltimoDiaMes, 6, UsuarioActual.CveEmpresa) Then
GvAcreedores.DataSource = ObjBancos.DtResultados
LblTotalAcreedores.Text = ObjBancos.DtResultados.SUM("Fluctuacion").FormatoNumero
HdnAcreedorCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString
HdnCveFluctuacionBitacora.Value = ObjBancos.DtResultados.MAX("CveFluctuacionBitacora").ToString
BtnAcreedoresRemove.Visible = HdnAcreedorCvePrePoliza.Value.ToEntero > 0
BtnGeneraAcreedores.Visible = Not HdnAcreedorCvePrePoliza.Value.ToEntero > 0
Else
GvAcreedores.DataSource = Nothing
Alert("Ocurrio un error al cargar los acreedores", TipoMensaje.MsgAdvertencia)
End If
ObjBancos.Dispose()
GvAcreedores.DataBind()
End Sub
Private Sub CargaDatosFiliales()
Dim ObjBancos As New ClsBancos
@@ -315,7 +398,7 @@ Partial Class Bancos_FluctuacionCambiaria
Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias
Total = LblTotal.ToDecimal
If Total > 0 Then
If Total < 0 Then
CveConceptoContable = 64
idCta = IdCtaGanancia
TipoMovto = True
@@ -327,7 +410,7 @@ Partial Class Bancos_FluctuacionCambiaria
Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal()
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Compras", CveConceptoContable, "Fluctuación Compras", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoCompras.SelectedValue.ToEntero) Then
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Proveedores Anticipos", CveConceptoContable, "Fluctuación Proveedores Anticipos", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoCompras.SelectedValue.ToEntero) Then
ErrorRegistrar = True
End If
@@ -338,13 +421,13 @@ Partial Class Bancos_FluctuacionCambiaria
If Not ErrorRegistrar Then
'saco las cuentas de pérdida y ganancia
For Each gvr As GridViewRow In GvCompras.Rows
For Each gvr As GridViewRow In GvProveedores.Rows
Total = gvr.DataKey("Fluctuacion").ToDecimal
'si es pérdida o ganancia
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString.ToEntero()
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
@@ -370,6 +453,86 @@ Partial Class Bancos_FluctuacionCambiaria
Conta.Dispose()
End Sub
Protected Sub BtnGeneraComprasAnt_Click(sender As Object, e As EventArgs)
Dim Total As Decimal = 0
Dim Conta As New ClsContabilidad
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaC", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoComprasAnt.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
Dim idCta As Integer = 0
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
Dim idCtaPerdida, IdCtaGanancia As Integer
Dim TipoMovto As Boolean = False
Dim CveConceptoContable As Integer = 0
Dim IdCtaComplementaria As Integer = 0
Dim ErrorRegistrar As Boolean = False
CveCuentaPerdida = 0 '55379
CveCuentaGanancia = 0 ' 55382
idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227
IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230
Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias
Total = LblTotal.ToDecimal
If Total > 0 Then
CveConceptoContable = 64
idCta = IdCtaGanancia
TipoMovto = True
Else
CveConceptoContable = 65
idCta = idCtaPerdida
TipoMovto = False
End If
Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal()
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Compras Anticipos", CveConceptoContable, "Fluctuación Proveedores Anticipos", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoComprasAnt.SelectedValue.ToEntero) Then
ErrorRegistrar = True
End If
Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 2, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CveBitacora <= 0 Then
ErrorRegistrar = True
End If
If Not ErrorRegistrar Then
'saco las cuentas de pérdida y ganancia
For Each gvr As GridViewRow In GvProveedoresAnt.Rows
Total = gvr.DataKey("Fluctuacion").ToDecimal
'si es pérdida o ganancia
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString.ToEntero()
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
If Not Conta.UpdateTCValuacion(-1, gvr.DataKey("CveCompra").ToEntero, gvr.DataKey("CveIE").ToEntero, TCUltimaFluctuacion, UsuarioActual.CveEmpresa) Then
ErrorRegistrar = True
Exit For
End If
Next
Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 2, CveBitacora, UsuarioActual.CveEmpresa)
End If
If Not ErrorRegistrar Then
Conta.Commit()
BtnGeneraComprasAnt.Visible = False
Alert(String.Format("La Fluctuación se ha generado <br/> <a href='/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}'>Ver PrePóliza</a>", CvePrePoliza), TipoMensaje.MsgInformacion)
Else
Conta.RollBack()
Alert("Error al generar la fluctuación", TipoMensaje.MsgError)
End If
Conta.Dispose()
End Sub
#End Region
#Region "FLUCTUACION VENTAS"
@@ -397,7 +560,7 @@ Partial Class Bancos_FluctuacionCambiaria
''
Total = LblTotalVentas.Text.ToDecimal
If Total > 0 Then
If Total < 0 Then
CveConceptoContable = 64
CveCuenta = CveCuentaGanancia
TipoMovto = True
@@ -442,7 +605,7 @@ Partial Class Bancos_FluctuacionCambiaria
End If
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), CveConconceptoCliente, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), CveConconceptoCliente, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
@@ -454,7 +617,7 @@ Partial Class Bancos_FluctuacionCambiaria
Next
If Not Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 2, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
If Not Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 3, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
ErrorRegistrar = True
End If
@@ -470,6 +633,261 @@ Partial Class Bancos_FluctuacionCambiaria
Conta.Dispose()
End Sub
Protected Sub BtnClientesAnticipos_Click(sender As Object, e As EventArgs)
Dim Total As Decimal = 0
Dim idCta As Integer = 0
Dim CveCuenta As Integer = 0
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
Dim idCtaPerdida, IdCtaGanancia As Integer
Dim TipoMovto As Boolean = False
Dim CveConceptoContable As Integer = 0
Dim IdCtaComplementaria As Integer = 0
Dim ErrorRegistrar As Boolean = False
CveCuentaPerdida = 0 '55379
CveCuentaGanancia = 0 ' 55382
idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227
IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230
Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias
Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal()
''
Total = LblTotalVentasAnt.Text.ToDecimal
If Total < 0 Then
CveConceptoContable = 64
CveCuenta = CveCuentaGanancia
TipoMovto = True
idCta = IdCtaGanancia
Else
CveConceptoContable = 65
CveCuenta = CveCuentaPerdida
idCta = idCtaPerdida
TipoMovto = False
End If
If Total = 0 Then
Alert("El Importe tiene que ser diferente a cero", TipoMensaje.MsgError)
Exit Sub
End If
Dim Conta As New ClsContabilidad
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaV", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoVentasAnt.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Ventas", CveConceptoContable, "Fluctuación Ventas", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlsubProyectoVentasAnt.SelectedValue.ToEntero) Then
ErrorRegistrar = True
End If
Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 4, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CveBitacora <= 0 Then
ErrorRegistrar = True
End If
Dim CveConconceptoCliente As Integer = 203
'saco las cuentas de pérdida y ganancia
For Each gvr As GridViewRow In GvClientesAnt.Rows
Total = gvr.DataKey("Fluctuacion").ToDecimal
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero()
If (gvr.DataKey("CveIE").ToEntero > 0 AndAlso gvr.DataKey("CveVenta").ToEntero < 0) OrElse (gvr.DataKey("CveVenta").ToEntero > 0 AndAlso gvr.DataKey("TipoDocto") = "Ant") Then
CveConconceptoCliente = 226
Else
CveConconceptoCliente = 203
End If
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), CveConconceptoCliente, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
If Not Conta.UpdateTCValuacion(gvr.DataKey("CveVenta").ToEntero, -1, gvr.DataKey("CveIE").ToEntero, TCUltimaFluctuacion, UsuarioActual.CveEmpresa) Then
ErrorRegistrar = True
Exit For
End If
Next
If Not Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 4, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
ErrorRegistrar = True
End If
If Not ErrorRegistrar Then
Conta.Commit()
BtnClientesAnticipos.Visible = False
Alert(String.Format("La Fluctuación se ha generado <br/> <a href='/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}'>Ver PrePóliza</a>", CvePrePoliza), TipoMensaje.MsgInformacion)
Else
Conta.RollBack()
Alert("Error al generar la fluctuación", TipoMensaje.MsgError)
End If
Conta.Dispose()
End Sub
#End Region
#Region "FLUCTUACION ACREEDORES"
Protected Sub BtnGeneraAcreedores_Click(sender As Object, e As EventArgs)
RegistraFluctuacionAcreedores()
End Sub
Private Sub RegistraFluctuacionAcreedores(Optional Anticipos As Boolean = False)
Dim Total As Decimal = 0
Dim Conta As New ClsContabilidad
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaA", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoAcreedores.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
Dim idCta As Integer = 0
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
Dim idCtaPerdida, IdCtaGanancia As Integer
Dim TipoMovto As Boolean = False
Dim CveConceptoContable As Integer = 0
Dim CveCuentaComplementaria As Integer = 55206
Dim IdCtaComplementaria As Integer = 1081
Dim ErrorRegistrar As Boolean = False
CveCuentaPerdida = 0 '55379
CveCuentaGanancia = 0 ' 55382
idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227
IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230
Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias
Total = LblTotalAcreedores.Text.ToDecimal
If Total < 0 Then
CveConceptoContable = 64
idCta = IdCtaGanancia
TipoMovto = True
Else
CveConceptoContable = 65
idCta = idCtaPerdida
TipoMovto = False
End If
Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal()
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Acreedores", CveConceptoContable, "Fluctuación Acreedores", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoAcreedores.SelectedValue.ToEntero) Then
ErrorRegistrar = True
End If
Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 5, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CveBitacora <= 0 Then
ErrorRegistrar = True
End If
'saco las cuentas de pérdida y ganancia
For Each gvr As GridViewRow In GvAcreedores.Rows
Total = gvr.DataKey("Fluctuacion").ToDecimal
'si es pérdida o ganancia
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero()
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), 202, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
If Not Conta.UpdateTCValuacion(-1, gvr.DataKey("CveCompra").ToEntero, gvr.DataKey("CveIE").ToEntero, TCUltimaFluctuacion, UsuarioActual.CveEmpresa) Then
ErrorRegistrar = True
Exit For
End If
Next
Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 5, CveBitacora, UsuarioActual.CveEmpresa)
If Not ErrorRegistrar Then
Conta.Commit()
BtnGeneraAcreedores.Visible = False
Alert(String.Format("La Fluctuación se ha generado <br/> <a href='/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}'>Ver Póliza</a>", CvePrePoliza), TipoMensaje.MsgInformacion)
Else
Conta.RollBack()
Alert("Error al generar la fluctuación", TipoMensaje.MsgError)
End If
Conta.Dispose()
Banco.Dispose()
End Sub
Protected Sub BtnGeneraAcreedoresAnt_Click(sender As Object, e As EventArgs)
Dim Total As Decimal = 0
Dim Conta As New ClsContabilidad
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaA", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoAcreedoresAnt.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
Dim idCta As Integer = 0
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
Dim idCtaPerdida, IdCtaGanancia As Integer
Dim TipoMovto As Boolean = False
Dim CveConceptoContable As Integer = 0
Dim CveCuentaComplementaria As Integer = 55206
Dim IdCtaComplementaria As Integer = 1081
Dim ErrorRegistrar As Boolean = False
CveCuentaPerdida = 0 '55379
CveCuentaGanancia = 0 ' 55382
idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227
IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230
Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias
Total = LblTotalAcreedoresAnt.Text.ToDecimal
If Total > 0 Then
CveConceptoContable = 64
idCta = IdCtaGanancia
TipoMovto = True
Else
CveConceptoContable = 65
idCta = idCtaPerdida
TipoMovto = False
End If
Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal()
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Acreedores", CveConceptoContable, "Fluctuación Acreedores Anticipos ", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoAcreeedoresAnt.SelectedValue.ToEntero) Then
ErrorRegistrar = True
End If
Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 6, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CveBitacora <= 0 Then
ErrorRegistrar = True
End If
'saco las cuentas de pérdida y ganancia
For Each gvr As GridViewRow In GvAcreedoresAnt.Rows
Total = gvr.DataKey("Fluctuacion").ToDecimal
'si es pérdida o ganancia
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero()
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), 202, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
If Not Conta.UpdateTCValuacion(-1, gvr.DataKey("CveCompra").ToEntero, gvr.DataKey("CveIE").ToEntero, TCUltimaFluctuacion, UsuarioActual.CveEmpresa) Then
ErrorRegistrar = True
Exit For
End If
Next
Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 6, CveBitacora, UsuarioActual.CveEmpresa)
If Not ErrorRegistrar Then
Conta.Commit()
BtnGeneraAcreedoresAnt.Visible = False
Alert(String.Format("La Fluctuación se ha generado <br/> <a href='/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}'>Ver Póliza</a>", CvePrePoliza), TipoMensaje.MsgInformacion)
Else
Conta.RollBack()
Alert("Error al generar la fluctuación", TipoMensaje.MsgError)
End If
Conta.Dispose()
Banco.Dispose()
End Sub
#End Region
#Region "FLUCTUACION BANCOS"
@@ -493,7 +911,6 @@ Partial Class Bancos_FluctuacionCambiaria
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaB", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoBancos.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
CveCuentaPerdida = 0 ' 55379
CveCuentaGanancia = 0 ' 55382
idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227
@@ -733,116 +1150,9 @@ Partial Class Bancos_FluctuacionCambiaria
#End Region
#Region "FLUCTUACION ACREEDORES"
Protected Sub BtnGeneraAcreedores_Click(sender As Object, e As EventArgs)
Dim Total As Decimal = 0
Dim Conta As New ClsContabilidad
Dim Banco As New ClsBancos(Conta.IniciaTransacSQL())
Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaA", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoAcreedores.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
Dim idCta As Integer = 0
Dim CveCuentaPerdida, CveCuentaGanancia As Integer
Dim idCtaPerdida, IdCtaGanancia As Integer
Dim TipoMovto As Boolean = False
Dim CveConceptoContable As Integer = 0
Dim CveCuentaComplementaria As Integer = 55206
Dim IdCtaComplementaria As Integer = 1081
Dim ErrorRegistrar As Boolean = False
CveCuentaPerdida = 0 '55379
CveCuentaGanancia = 0 ' 55382
idCtaPerdida = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria '1227
IdCtaGanancia = UsuarioActual.Empresa.IdCuentaGananciaCambiaria '1230
Dim TC As Decimal = 2 ' se pone 2, para que cumpla con el check constrains de complementarias
Total = LblTotalAcreedores.Text.ToDecimal
If Total > 0 Then
CveConceptoContable = 64
idCta = IdCtaGanancia
TipoMovto = True
Else
CveConceptoContable = 65
idCta = idCtaPerdida
TipoMovto = False
End If
Dim TCUltimaFluctuacion As Decimal = GlobalTipoCambio(FechaUltimoDiaMes).ToDecimal()
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Acreedores", CveConceptoContable, "Fluctuación Acreedores", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoAcreedores.SelectedValue.ToEntero) Then
ErrorRegistrar = True
End If
Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 6, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
If CveBitacora <= 0 Then
ErrorRegistrar = True
End If
'saco las cuentas de pérdida y ganancia
For Each gvr As GridViewRow In GvAcreedores.Rows
Total = gvr.DataKey("Fluctuacion").ToDecimal
'si es pérdida o ganancia
IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero()
'movimiento de complementaria
If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), 202, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then
ErrorRegistrar = True
Exit For
End If
If Not Conta.UpdateTCValuacion(-1, gvr.DataKey("CveCompra").ToEntero, gvr.DataKey("CveIE").ToEntero, TCUltimaFluctuacion, UsuarioActual.CveEmpresa) Then
ErrorRegistrar = True
Exit For
End If
Next
Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 6, CveBitacora, UsuarioActual.CveEmpresa)
If Not ErrorRegistrar Then
Conta.Commit()
BtnGeneraAcreedores.Visible = False
Alert(String.Format("La Fluctuación se ha generado <br/> <a href='/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}'>Ver Póliza</a>", CvePrePoliza), TipoMensaje.MsgInformacion)
Else
Conta.RollBack()
Alert("Error al generar la fluctuación", TipoMensaje.MsgError)
End If
Conta.Dispose()
Banco.Dispose()
End Sub
#End Region
#Region "GRIDVIEWS"
Protected Sub GvCompras_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCompras.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'TipoCambio = e.Row.DBCampo("TipoCambio").ToString.ToDouble
'e.Row.FCLabel("LbTipoCambioActual").Text = TipoCambioActual.ToString
'e.Row.FCLabel("LbTipoCambio").Text = If(TipoCambio > 0, TipoCambio.ToString, "No hay TipoCambio")
'e.Row.FCLabel("LbFluctuacion").Text = If(TipoCambio > 0, ((TipoCambio - TipoCambioActual) * e.Row.DBCampo("Saldo").ToString.ToDouble).ToString.FormatoNumero, "No aplica")
'If e.Row.FCLabel("LbFluctuacion").Text = "No aplica" Then
' e.Row.BackColor = Drawing.Color.LightSalmon
'ElseIf e.Row.FCLabel("LbFluctuacion").Text.ToDouble < 0 Then
' e.Row.BackColor = Drawing.Color.LightGoldenrodYellow
'End If
'e.Row.FCHyperLink("HLProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor").ToString.ToEntero)
'If Not e.Row.DBCampo("IdCtaContProveedores").ToString.ToEntero > 0 Then
' e.Row.FCHyperLink("HLProveedor").ForeColor = Drawing.Color.Red
'End If
'If e.Row.DBCampo("Fluctuacion").ToString.ToDouble < 0 Then
' e.Row.BackColor = Drawing.Color.LightGoldenrodYellow
'End If
'If e.Row.DBCampo("SinTipoCambio").ToString.ToEntero > 0 Then
' e.Row.BackColor = Drawing.Color.LightSalmon
'End If
End If
End Sub
Protected Sub GvCuentas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCuentas.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'TipoCambio = e.Row.DBCampo("TipoCambio").ToString.ToDouble
@@ -885,6 +1195,7 @@ Partial Class Bancos_FluctuacionCambiaria
If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnProveedorCvePrePoliza.Value.ToEntero, 1, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
Banco.Commit()
BtnProveedoresRemove.visible = False
Alert("Flucturación eliminada.")
Else
Banco.RollBack()
@@ -893,12 +1204,41 @@ Partial Class Bancos_FluctuacionCambiaria
End Sub
Protected Sub BtnProveedoresAntRemove_Click(sender As Object, e As EventArgs)
Dim Banco As New ClsBancos
Banco.IniciaTransacSQL()
If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnProveedorAntCvePrePoliza.Value.ToEntero, 2, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
Banco.Commit()
BtnProveedoresAntRemove.Visible = False
Alert("Flucturación eliminada.")
Else
Banco.RollBack()
End If
Banco.Dispose()
End Sub
Protected Sub BtnClientesRemove_Click(sender As Object, e As EventArgs)
Dim Banco As New ClsBancos
Banco.IniciaTransacSQL()
If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnClienteCvePrePoliza.Value.ToEntero, 2, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnClienteCvePrePoliza.Value.ToEntero, 3, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
Banco.Commit()
BtnClientesRemove.Visible = False
Alert("Flucturación eliminada.")
Else
Banco.RollBack()
End If
Banco.Dispose()
End Sub
Protected Sub BtnClientesAntRemove_Click(sender As Object, e As EventArgs)
Dim Banco As New ClsBancos
Banco.IniciaTransacSQL()
If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnClienteAntCvePrePoliza.Value.ToEntero, 4, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
Banco.Commit()
BtnClientesAntRemove.Visible = False
Alert("Flucturación eliminada.")
Else
Banco.RollBack()
@@ -910,12 +1250,30 @@ Partial Class Bancos_FluctuacionCambiaria
Dim Banco As New ClsBancos
Banco.IniciaTransacSQL()
If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnAcreedorCvePrePoliza.Value.ToEntero, 6, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnAcreedorCvePrePoliza.Value.ToEntero, 5, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
Banco.Commit()
BtnAcreedoresRemove.Visible = False
Alert("Flucturación eliminada.")
Else
Banco.RollBack()
End If
Banco.Dispose()
End Sub
Protected Sub BtnAcreedoresAntRemove_Click(sender As Object, e As EventArgs)
Dim Banco As New ClsBancos
Banco.IniciaTransacSQL()
If Banco.FluctuacionesBitacoraPrePolizaRemove(HdnAcreedorAntCvePrePoliza.Value.ToEntero, 6, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then
Banco.Commit()
BtnAcreedoresAntRemove.Visible = False
Alert("Flucturación eliminada.")
Else
Banco.RollBack()
End If
Banco.Dispose()
End Sub
End Class