This commit is contained in:
janeth arvizu
2019-10-09 12:09:10 -07:00
parent fabc1e6ceb
commit f6b2882ba2
4 changed files with 465 additions and 329 deletions

View File

@@ -992,6 +992,7 @@
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Label ID="LblTC" runat="server" Text=""></asp:Label>
<asp:Label ID="LblTCO" runat="server" Text=""></asp:Label>
<div runat="server" id="DivTC" visible="false">
TC:
<asp:TextBox ID="TxtTC" Text="" Width="50px" runat="server" />

View File

@@ -2376,7 +2376,10 @@ Partial Class Compras_Compras
CompraSaldo = TxtTotal.Text.ToDouble
TipoCambio = dr("TipoCambio").ToString.ToDouble
Dim TipoCambioOriginal = dr("TipoCambioOriginal").ToString.ToDouble
If TipoCambio > 1 Then LblTC.Text = String.Format("TC: {0}", TipoCambio.ToString("N4"))
If TipoCambio <> TipoCambioOriginal Then LblTCO.Text = String.Format("<br/>TC Original: {0}", TipoCambioOriginal.ToString("N4"))
AsignaValoresOriginales(TxtSubTotal.Text.ToDouble, TxtSubTotal2.Text.ToDouble, TxtIVA.Text.ToDouble, TxtRetIVA.Text.ToDouble, TxtRetISR.Text.ToDouble, TxtTotal.Text.ToDouble)
CalculaTotalPorDevengar()

View File

@@ -1248,6 +1248,7 @@
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Cotizaciones</span>
</div>
<div class="actions">
<div class="btn-group">
<input type="text" id="TxtBusquedaCotizacion" class="form-control input-sm"
@@ -1257,6 +1258,22 @@
style="margin-top: -3px; float: inherit;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<div class="actions">
<div class="btn-group">
<asp:UpdatePanel UpdateMode="Conditional" runat="server" ID="UpRepProveedoresPagosBancos" Visible="false">
<ContentTemplate>
<asp:LinkButton ID="LnkCotizacionesPDF" runat="server" data-toggle="tooltip" Title="PDF"> <i class="fa fa-file-pdf-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
<asp:LinkButton ID="LnkCotizacionesExcel" runat="server" data-toggle="tooltip" Title="Excel"><i class="fa fa-file-excel-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkCotizacionesPDF" />
<asp:PostBackTrigger ControlID="LnkCotizacionesExcel" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</div>
<div class="portlet-body ">
<div class="table-scrollable">
@@ -1741,6 +1758,16 @@
</div>
<div class="actions">
<div class="btn-group">
<asp:UpdatePanel UpdateMode="Conditional" runat="server" ID="UpdatePanel2" Visible="false">
<ContentTemplate>
<asp:LinkButton ID="LnkCxCActivasPDF" runat="server" data-toggle="tooltip" Title="PDF"> <i class="fa fa-file-pdf-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
<asp:LinkButton ID="LnkCxCActivasExcel" runat="server" data-toggle="tooltip" Title="Excel"><i class="fa fa-file-excel-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkCxCActivasPDF" />
<asp:PostBackTrigger ControlID="LnkCxCActivasExcel" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</div>
@@ -1814,6 +1841,16 @@
</div>
<div class="actions">
<div class="btn-group">
<asp:UpdatePanel UpdateMode="Conditional" runat="server" ID="UpdatePanel6" Visible="false">
<ContentTemplate>
<asp:LinkButton ID="LnkHistorialCxCPDF" runat="server" data-toggle="tooltip" Title="PDF"> <i class="fa fa-file-pdf-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
<asp:LinkButton ID="LnkHistorialCxCExcel" runat="server" data-toggle="tooltip" Title="Excel"><i class="fa fa-file-excel-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkHistorialCxCPDF" />
<asp:PostBackTrigger ControlID="LnkHistorialCxCExcel" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</div>
@@ -1898,6 +1935,16 @@
</div>
<div class="actions">
<div class="btn-group">
<asp:UpdatePanel UpdateMode="Conditional" runat="server" ID="UpdatePanel7" Visible="false">
<ContentTemplate>
<asp:LinkButton ID="LnkAnticipoClientePDF" runat="server" data-toggle="tooltip" Title="PDF"> <i class="fa fa-file-pdf-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
<asp:LinkButton ID="LnkAnticipoClienteExcel" runat="server" data-toggle="tooltip" Title="Excel"><i class="fa fa-file-excel-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkAnticipoClientePDF" />
<asp:PostBackTrigger ControlID="LnkAnticipoClienteExcel" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</div>
@@ -1944,6 +1991,16 @@
</div>
<div class="actions">
<div class="btn-group">
<asp:UpdatePanel UpdateMode="Conditional" runat="server" ID="UpdatePanel8" Visible="false">
<ContentTemplate>
<asp:LinkButton ID="LnkAnticipoHistorialPDF" runat="server" data-toggle="tooltip" Title="PDF"> <i class="fa fa-file-pdf-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
<asp:LinkButton ID="LnkAnticipoHistorialExcel" runat="server" data-toggle="tooltip" Title="Excel"><i class="fa fa-file-excel-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkAnticipoHistorialPDF" />
<asp:PostBackTrigger ControlID="LnkAnticipoHistorialExcel" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</div>
@@ -2003,16 +2060,27 @@
<span class="caption-subject bold uppercase">Cuentas Bancarias</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
<a href="javascript:;" class="remove" data-original-title="" title=""></a>
</div>
<div class="actions">
<div class="btn-group">
<asp:UpdatePanel UpdateMode="Conditional" runat="server" ID="UpdatePanel9" Visible="false">
<ContentTemplate>
<asp:LinkButton ID="LnkCuentasBancariasPDF" runat="server" data-toggle="tooltip" Title="PDF"> <i class="fa fa-file-pdf-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
<asp:LinkButton ID="LnkCuentasBancariasExcel" runat="server" data-toggle="tooltip" Title="Excel"><i class="fa fa-file-excel-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkCuentasBancariasPDF" />
<asp:PostBackTrigger ControlID="LnkCuentasBancariasExcel" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</div>
<div class="portlet-body ">
<asp:UpdatePanel ID="UpCuentasBancos" runat="server" UpdateMode="Conditional">
@@ -5496,7 +5564,7 @@
<table border="0" cellpadding="0" class="Widthall grides" cellspacing="0">
<tbody>
<tr class="Titulos" style="font-size:12px">
<tr class="Titulos" style="font-size: 12px">
<th style="width: 28px">#</th>
<th style="width: 200px">MARCA</th>
<th width="73px">DCTO COM</th>
@@ -5546,17 +5614,17 @@
<%-- <asp:RequiredFieldValidator ID="RFVPorcentaje3" runat="server" ControlToValidate="txtPorcentaje3" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''%'' Porcentaje</b> es necesario, por favor ingréselo." ValidationGroup="GprAgrega"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender6" runat="server" HighlightCssClass="vco" TargetControlID="RFVPorcentaje3" Width="300px"></ajax:ValidatorCalloutExtender>--%>
</td>
<td>
<asp:TextBox ID="txtProntoPago" CssClass="form-control input-sm" Width="55px" MaxLength="15" runat="server" ValidationGroup="GprAgrega" Style="text-align: right"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender7" runat="server" TargetControlID="txtProntoPago" FilterType="Custom, Numbers" ValidChars=".," />
<%-- <asp:RequiredFieldValidator ID="RFVProntoPago" runat="server" ControlToValidate="txtProntoPago" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''PRONTO PAGO''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgrega"></asp:RequiredFieldValidator>
<%-- <asp:RequiredFieldValidator ID="RFVProntoPago" runat="server" ControlToValidate="txtProntoPago" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''PRONTO PAGO''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgrega"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEProntoPago" runat="server" HighlightCssClass="vco" TargetControlID="RFVProntoPago" Width="300px"></ajax:ValidatorCalloutExtender>--%>
</td>
<td>
<asp:TextBox ID="txtPlazo" CssClass="form-control input-sm" Width="55px" MaxLength="15" runat="server" ValidationGroup="GprAgrega" Style="text-align: right"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender8" runat="server" TargetControlID="txtPlazo" FilterType="Custom, Numbers" />
<%-- <asp:RequiredFieldValidator ID="RFVPlazo" runat="server" ControlToValidate="txtPlazo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''PLAZO''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgrega"></asp:RequiredFieldValidator>
<%-- <asp:RequiredFieldValidator ID="RFVPlazo" runat="server" ControlToValidate="txtPlazo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''PLAZO''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgrega"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEPlazo" runat="server" HighlightCssClass="vco" TargetControlID="RFVPlazo" Width="300px"></ajax:ValidatorCalloutExtender>--%>
</td>
@@ -5638,7 +5706,7 @@
<FooterStyle HorizontalAlign="Right"></FooterStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="">
<EditItemTemplate>
<asp:TextBox ID="TxtPlazoP" CssClass="form-control input-sm" runat="server" Width="80px" Text='<%# Eval("Plazo")%>' Style="text-align: right"></asp:TextBox>

View File

@@ -9471,326 +9471,390 @@ Partial Class Clientes
Next
Return Timbre
End Function
'Private Function GenerarNotaCredito(CvePS As Integer, Tipo As Integer, CveUnidadMedida As Integer, Importe As Decimal, Iva As Decimal, Descripcion As String, CveClasificacion As Integer) As Boolean
' Dim Respuesta As Boolean = False
' Dim ObjVentas As New ClsVentas
' Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
' Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
' Dim ErrorVentas As Boolean = False
' Dim SubTotal As Decimal = Importe
' Dim Total As Decimal = Importe + Iva
' Dim RetIVA As Decimal = 0
' Dim RetISR As Decimal = 0
' Dim TipoCambio As Decimal = 0
' Dim FechaVencimiento As Date = Now
' Dim fecha As Date = Now
' Dim Folio As Integer = 0
' Dim Serie As String = ""
' If FolioNotaCredito() Then
' Folio = FolioNotaAcumulador
' Serie = SerieNotaAcumulador
' End If
' Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero
' Dim CveVenta As Integer
' If Folio > 0 Then
' Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas($"Clientes/{Descripcion}", 1, Total, Total, 1, fecha, "Nota de crédito por Cargo", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
' If ObjVentas.AddVenta("Egs", Folio, CveCliente.ToEntero, -1, SubTotal, 0, 0, Iva, RetIVA, RetISR, Total, 1, TipoCambio,
' 0, 0, 0, FechaVencimiento, fecha, "", "", fecha, -1, "", "", "", 0, 0, 0, "-1".ToDate, "-1".ToDate, "-1".ToDate, -1, -1, 0, CvePrePoliza,
' UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Serie:=Serie, CveSubProyecto:=CveSubProyecto, CveSubProyectoEjecucion:=CveSubProyecto) Then
' CveVenta = ObjVentas.CveVenta
' If CveVenta > 0 Then
' If ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, 0.16, SubTotal * 0.16, Descripcion, 0, 0, -1, 0) Then
' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, SubTotal, Folio.ToString, 150, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, ImporteMX:=SubTotal, CveSubProyecto:=CveSubProyecto) Then
' ErrorVentas = True
' End If
' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio.ToString, 12, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total) Then
' ErrorVentas = True
' End If
' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Iva, Folio.ToString, 13, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Iva) Then
' ErrorVentas = True
' End If
' If Not ErrorVentas Then
' For Each GvRow As GridViewRow In GvAcum.Rows
' Dim CveMovto As Integer = GvRow.DataKey("CveMovto").ToEntero
' If (Tipo = 1 And GvRow.FCCheckBox("ChkCargo").Checked) Or (Tipo = 2 And GvRow.FCCheckBox("ChkBonificacion").Checked) Then
' If ObjAcum.DistribuidorActualizarFacturados(CveMovto, UsuarioActual.CveEmpresa, Tipo, CveVenta) Then
' Respuesta = True
' ErrorVentas = False
' CveVentaNota = CveVenta
' Else
' Respuesta = False
' ErrorVentas = True
' CveVentaNota = 0
' Exit For
' End If
' End If
' Next
' End If
' If Not ErrorVentas Then
' Alert($"Nota de crédito generada correctamente <a href='./Ventas.aspx?CveVenta={CveVenta}' >{Serie}-{Folio}</a>")
' End If
' Else
' ErrorVentas = True
' End If
' Else
' ErrorVentas = True
' End If
' Else
' ErrorVentas = True
' End If
' Else
' Alert("No se pudo obtener el Folio.", TipoMensaje.MsgError)
' End If
' If ErrorVentas Then
' ObjVentas.RollBack()
' Else
' ObjVentas.Commit()
' CargaUsados()
' Dim DtDetallesVenta As New DataTable
' If ObjVentas.GetVentaDetalle(CveVenta) Then
' DtDetallesVenta = ObjVentas.DtResultados
' 'CreaObjetosVenta(CveVenta, Serie, Folio, SubTotal, Iva, DtDetallesVenta)
' ObjFactura.Timbre = PreParaTimbre(ObjFactura, ObjFactura.CveSubProyecto)
' Dim ObjTimbrado As New Timbrado
' Dim SeTimbro As Boolean = False
' SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
' If SeTimbro Then
' Alert("Se timbro correctamente")
' Else
' Alert("No se pudo timbrar, intente mas tarde.", TipoMensaje.MsgError)
' End If
' Else
' Alert("No se pudo timbrar, no se pudieron obtener los detalles de la venta.", TipoMensaje.MsgError)
' End If
' End If
' ObjVentas.Dispose()
' Return Respuesta
'End Function
'Private Function generaNC(CveVenta As Integer, ByRef ObjVentas As ClsVentas, ByVal factura As Modelos.Factura) As List(Of Object)
' Dim Obj As New List(Of Object)
' Dim CveVentaNueva As Integer = ObjVentas.CveVenta
' Dim BanderaGeneraNC As Boolean = False
' If UsuarioActual.CveEmpresa.Contiene(1, 119) Then BanderaGeneraNC = True
' If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
' If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
' Dim drv As DataRow = ObjVentas.DtResultados.Rows(0)
' Dim TmpDTconceptos As DataTable = Nothing
' ''CargaCliente
' Dim CveCliente As Integer = drv("CveCliente").ToString.ToEntero
' If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then
' Return Nothing
' ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then
' Return Nothing
' End If
' factura.TipoDocto = drv("TipoDocto").ToString
' factura.Serie = drv("Serie").ToString
' factura.FechaEjecucion = drv("FechaEjecucion").ToString.ToDateTime
' factura.Fecha = drv("Fecha").ToString.ToDateTime
' factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString.ToEntero
' factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString.ToEntero
' factura.CveClienteSucursal = drv("CveClienteSucursal").ToString.ToEntero
' factura.CveSubProyecto = drv("CveSubProyecto").ToString.ToEntero
' ''CargaDetalle
' If ObjVentas.GetVentaDetalle(CveVenta) Then
' TmpDTconceptos = ObjVentas.DtResultados
' TmpDTconceptos.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
' GvPS.DataSource = TmpDTconceptos
' GvPS.DataBind()
' End If
' '' Carga Totales
' factura.SubTotal = drv("SubTotal").ToString.ToDecimal
' factura.Descuento = drv("Descuento").ToString.ToDecimal
' factura.Amortizacion = drv("Amortizacion").ToString.ToDecimal
' factura.IVA = drv("IVA").ToString.ToDecimal
' factura.RetIVA = drv("RetIVA").ToString.ToDecimal
' factura.RetISR = drv("RetISR").ToString.ToDecimal
' factura.Total = drv("Total").ToString.ToDecimal
' factura.MotivoDescuento = drv("MotivoDescuento").ToString
' factura.Observaciones = drv("Observaciones").ToString
' factura.CveMoneda = drv("CveMoneda").ToString.ToEntero
' factura.TipoCambio = drv("TipoCambio").ToString.ToDecimal
' factura.CveVendedor = drv("CveVendedor").ToString.ToEntero
' factura.RefDocto = drv("Ref").ToString
' If factura.CveCliente > 0 Then
' If Not IsNothing(TmpDTconceptos) AndAlso TmpDTconceptos.Rows.Count > 0 Then
' If Not drv("Total").ToString.ToDecimal = factura.Total Then
' Return Nothing
' End If
' End If
' End If
' End If
' End If
' If Obj.Count > 0 Then
' Return Obj
' Else
' Return Nothing
' End If
'End Function
'Private Function PreParaTimbre(Obj As Modelos.Factura, CveSubProyecto As Integer) As CFDITimbre
' Dim Timbre As New CFDITimbre
' Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", ""))
' Timbre.Comprobante.Folio = Obj.Folio.ToString
' Timbre.Comprobante.Serie = Obj.Serie
' Timbre.Comprobante.Fecha = Obj.Fecha
' Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33
' Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33
' Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT
' Timbre.Comprobante.Subtotal = Obj.SubTotal
' Timbre.Comprobante.Descuentos = Obj.Descuento
' Timbre.Comprobante.Moneda = Obj.MonedaSAT
' Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString)
' Timbre.Comprobante.Total = Obj.Total
' Try
' Obj.SetSubProyecto(Me)
' Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP
' Catch ex As Exception
' End Try
' Timbre.Comprobante.Confirmacion = ""
' Timbre.Receptor.RFC = TxtRFC.Text
' Timbre.Receptor.Nombre = TxtNombre.Text
' Timbre.Receptor.ResidenciaFiscal = ""
' Timbre.Receptor.NumeroRegistroTributario = ""
' Timbre.Receptor.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}")
' Dim totSubTotal As Decimal = Obj.SubTotal
' Dim totIVA As Decimal = Obj.IVA
' Dim totRetIVA As Decimal = Obj.RetIVA
' Dim totRetISR As Decimal = Obj.RetISR
' Dim TasaRetIVA As Decimal = 0
' Dim TasaRetISR As Decimal = 0
' Dim i As Integer = 1
' ''detalles
' Dim tPS As String = ""
' For Each drr As DataRow In Obj.DtDetalle.Rows
' If drr("PS").ToString.Length = 1 Then
' tPS = drr("Obs").ToString
' Else
' If drr("PS").ToString.Length = 0 Then
' tPS = ""
' Else
' tPS = String.Format("{0} {1}", drr("PS"), drr("Obs"))
' End If
' End If
' '' condicionante, especial
' If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" ' les comentan que no debe de ir la etiqueta de "unidad" en el producto
' Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal,
' .Descripcion = tPS,
' .ValorUnitario = drr("PU").ToString.ToDecimal,
' .Importe = drr("TotalImporte").ToString.ToDecimal,
' .Descuento = drr("Descuento").ToString.ToDecimal,
' .Unidad = drr("UM").ToString,
' .ClaveUnidad = drr("SATClaveUM").ToString,
' .ClaveProdServ = drr("SATClaveProdServ").ToString,
' .Noidentificacion = drr("Noidentificacion").ToString,
' .CuentaPredial = drr("CuentaPredial").ToString}
' '' verifica suma subtotales
' If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'proceso de ajusta de decimales
' concepto.Importe = totSubTotal
' End If
' totSubTotal = totSubTotal - concepto.Importe
' ''siempre estaremos agregando el iva, auqnue sea en importe cero o tasa cero, para que se emita la factura
' If drr("ImporteIVA").ToString.ToDouble > 0 Then
' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal})
' End If
' If drr("ImporteIEPS").ToString.ToDouble > 0 Then
' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal})
' End If
' If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones
' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetIVA, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal})
' End If
' If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR
' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetISR, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal})
' End If
' Timbre.Conceptos.Add(concepto)
' i += 1
' Next
' Dim AplicaComercioExteriorSubProyecto As Boolean = If(GlobalDTSubProyectos(-1, Obj.CveSubProyecto)(0)("AplicaComercioExterior").ToString = "True", True, False)
' Timbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto = AplicaComercioExteriorSubProyecto
' If Obj.Cliente.AplicaComercioExterior And AplicaComercioExteriorSubProyecto Then
' Timbre.Receptor.ResidenciaFiscal = Obj.Cliente.ClaveSATPais
' Timbre.Receptor.NumeroRegistroTributario = Obj.Cliente.NumRegIdTrib
' End If
' Return Timbre
'End Function
End Function
'Private Function GenerarNotaCredito(CvePS As Integer, Tipo As Integer, CveUnidadMedida As Integer, Importe As Decimal, Iva As Decimal, Descripcion As String, CveClasificacion As Integer) As Boolean
' Dim Respuesta As Boolean = False
' Dim ObjVentas As New ClsVentas
' Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
' Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
' Dim ErrorVentas As Boolean = False
' Dim SubTotal As Decimal = Importe
' Dim Total As Decimal = Importe + Iva
' Dim RetIVA As Decimal = 0
' Dim RetISR As Decimal = 0
' Dim TipoCambio As Decimal = 0
' Dim FechaVencimiento As Date = Now
' Dim fecha As Date = Now
' Dim Folio As Integer = 0
' Dim Serie As String = ""
' If FolioNotaCredito() Then
' Folio = FolioNotaAcumulador
' Serie = SerieNotaAcumulador
' End If
' Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero
' Dim CveVenta As Integer
' If Folio > 0 Then
' Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas($"Clientes/{Descripcion}", 1, Total, Total, 1, fecha, "Nota de crédito por Cargo", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
' If ObjVentas.AddVenta("Egs", Folio, CveCliente.ToEntero, -1, SubTotal, 0, 0, Iva, RetIVA, RetISR, Total, 1, TipoCambio,
' 0, 0, 0, FechaVencimiento, fecha, "", "", fecha, -1, "", "", "", 0, 0, 0, "-1".ToDate, "-1".ToDate, "-1".ToDate, -1, -1, 0, CvePrePoliza,
' UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Serie:=Serie, CveSubProyecto:=CveSubProyecto, CveSubProyectoEjecucion:=CveSubProyecto) Then
' CveVenta = ObjVentas.CveVenta
' If CveVenta > 0 Then
' If ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, 0.16, SubTotal * 0.16, Descripcion, 0, 0, -1, 0) Then
' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, SubTotal, Folio.ToString, 150, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, ImporteMX:=SubTotal, CveSubProyecto:=CveSubProyecto) Then
' ErrorVentas = True
' End If
' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio.ToString, 12, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total) Then
' ErrorVentas = True
' End If
' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Iva, Folio.ToString, 13, String.Format("{0}-{1}", Serie, Folio), fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Iva) Then
' ErrorVentas = True
' End If
' If Not ErrorVentas Then
' For Each GvRow As GridViewRow In GvAcum.Rows
' Dim CveMovto As Integer = GvRow.DataKey("CveMovto").ToEntero
' If (Tipo = 1 And GvRow.FCCheckBox("ChkCargo").Checked) Or (Tipo = 2 And GvRow.FCCheckBox("ChkBonificacion").Checked) Then
' If ObjAcum.DistribuidorActualizarFacturados(CveMovto, UsuarioActual.CveEmpresa, Tipo, CveVenta) Then
' Respuesta = True
' ErrorVentas = False
' CveVentaNota = CveVenta
' Else
' Respuesta = False
' ErrorVentas = True
' CveVentaNota = 0
' Exit For
' End If
' End If
' Next
' End If
' If Not ErrorVentas Then
' Alert($"Nota de crédito generada correctamente <a href='./Ventas.aspx?CveVenta={CveVenta}' >{Serie}-{Folio}</a>")
' End If
' Else
' ErrorVentas = True
' End If
' Else
' ErrorVentas = True
' End If
' Else
' ErrorVentas = True
' End If
' Else
' Alert("No se pudo obtener el Folio.", TipoMensaje.MsgError)
' End If
' If ErrorVentas Then
' ObjVentas.RollBack()
' Else
' ObjVentas.Commit()
' CargaUsados()
' Dim DtDetallesVenta As New DataTable
' If ObjVentas.GetVentaDetalle(CveVenta) Then
' DtDetallesVenta = ObjVentas.DtResultados
' 'CreaObjetosVenta(CveVenta, Serie, Folio, SubTotal, Iva, DtDetallesVenta)
' ObjFactura.Timbre = PreParaTimbre(ObjFactura, ObjFactura.CveSubProyecto)
' Dim ObjTimbrado As New Timbrado
' Dim SeTimbro As Boolean = False
' SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
' If SeTimbro Then
' Alert("Se timbro correctamente")
' Else
' Alert("No se pudo timbrar, intente mas tarde.", TipoMensaje.MsgError)
' End If
' Else
' Alert("No se pudo timbrar, no se pudieron obtener los detalles de la venta.", TipoMensaje.MsgError)
' End If
' End If
' ObjVentas.Dispose()
' Return Respuesta
'End Function
'Private Function generaNC(CveVenta As Integer, ByRef ObjVentas As ClsVentas, ByVal factura As Modelos.Factura) As List(Of Object)
' Dim Obj As New List(Of Object)
' Dim CveVentaNueva As Integer = ObjVentas.CveVenta
' Dim BanderaGeneraNC As Boolean = False
' If UsuarioActual.CveEmpresa.Contiene(1, 119) Then BanderaGeneraNC = True
' If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
' If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
' Dim drv As DataRow = ObjVentas.DtResultados.Rows(0)
' Dim TmpDTconceptos As DataTable = Nothing
' ''CargaCliente
' Dim CveCliente As Integer = drv("CveCliente").ToString.ToEntero
' If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not CveCliente.Contiene(10450, 10460, 10458) Then
' Return Nothing
' ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not CveCliente.Contiene(27448) Then
' Return Nothing
' End If
' factura.TipoDocto = drv("TipoDocto").ToString
' factura.Serie = drv("Serie").ToString
' factura.FechaEjecucion = drv("FechaEjecucion").ToString.ToDateTime
' factura.Fecha = drv("Fecha").ToString.ToDateTime
' factura.CveSubProyectoEjecucion = drv("CveSubProyectoEjecucion").ToString.ToEntero
' factura.CveSubProyectoCobranza = drv("CveSubProyectoCobranza").ToString.ToEntero
' factura.CveClienteSucursal = drv("CveClienteSucursal").ToString.ToEntero
' factura.CveSubProyecto = drv("CveSubProyecto").ToString.ToEntero
' ''CargaDetalle
' If ObjVentas.GetVentaDetalle(CveVenta) Then
' TmpDTconceptos = ObjVentas.DtResultados
' TmpDTconceptos.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
' GvPS.DataSource = TmpDTconceptos
' GvPS.DataBind()
' End If
' '' Carga Totales
' factura.SubTotal = drv("SubTotal").ToString.ToDecimal
' factura.Descuento = drv("Descuento").ToString.ToDecimal
' factura.Amortizacion = drv("Amortizacion").ToString.ToDecimal
' factura.IVA = drv("IVA").ToString.ToDecimal
' factura.RetIVA = drv("RetIVA").ToString.ToDecimal
' factura.RetISR = drv("RetISR").ToString.ToDecimal
' factura.Total = drv("Total").ToString.ToDecimal
' factura.MotivoDescuento = drv("MotivoDescuento").ToString
' factura.Observaciones = drv("Observaciones").ToString
' factura.CveMoneda = drv("CveMoneda").ToString.ToEntero
' factura.TipoCambio = drv("TipoCambio").ToString.ToDecimal
' factura.CveVendedor = drv("CveVendedor").ToString.ToEntero
' factura.RefDocto = drv("Ref").ToString
' If factura.CveCliente > 0 Then
' If Not IsNothing(TmpDTconceptos) AndAlso TmpDTconceptos.Rows.Count > 0 Then
' If Not drv("Total").ToString.ToDecimal = factura.Total Then
' Return Nothing
' End If
' End If
' End If
' End If
' End If
' If Obj.Count > 0 Then
' Return Obj
' Else
' Return Nothing
' End If
'End Function
'Private Function PreParaTimbre(Obj As Modelos.Factura, CveSubProyecto As Integer) As CFDITimbre
' Dim Timbre As New CFDITimbre
' Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", ""))
' Timbre.Comprobante.Folio = Obj.Folio.ToString
' Timbre.Comprobante.Serie = Obj.Serie
' Timbre.Comprobante.Fecha = Obj.Fecha
' Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33
' Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33
' Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT
' Timbre.Comprobante.Subtotal = Obj.SubTotal
' Timbre.Comprobante.Descuentos = Obj.Descuento
' Timbre.Comprobante.Moneda = Obj.MonedaSAT
' Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString)
' Timbre.Comprobante.Total = Obj.Total
' Try
' Obj.SetSubProyecto(Me)
' Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP
' Catch ex As Exception
' End Try
' Timbre.Comprobante.Confirmacion = ""
' Timbre.Receptor.RFC = TxtRFC.Text
' Timbre.Receptor.Nombre = TxtNombre.Text
' Timbre.Receptor.ResidenciaFiscal = ""
' Timbre.Receptor.NumeroRegistroTributario = ""
' Timbre.Receptor.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}")
' Dim totSubTotal As Decimal = Obj.SubTotal
' Dim totIVA As Decimal = Obj.IVA
' Dim totRetIVA As Decimal = Obj.RetIVA
' Dim totRetISR As Decimal = Obj.RetISR
' Dim TasaRetIVA As Decimal = 0
' Dim TasaRetISR As Decimal = 0
' Dim i As Integer = 1
' ''detalles
' Dim tPS As String = ""
' For Each drr As DataRow In Obj.DtDetalle.Rows
' If drr("PS").ToString.Length = 1 Then
' tPS = drr("Obs").ToString
' Else
' If drr("PS").ToString.Length = 0 Then
' tPS = ""
' Else
' tPS = String.Format("{0} {1}", drr("PS"), drr("Obs"))
' End If
' End If
' '' condicionante, especial
' If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" ' les comentan que no debe de ir la etiqueta de "unidad" en el producto
' Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString.ToDecimal,
' .Descripcion = tPS,
' .ValorUnitario = drr("PU").ToString.ToDecimal,
' .Importe = drr("TotalImporte").ToString.ToDecimal,
' .Descuento = drr("Descuento").ToString.ToDecimal,
' .Unidad = drr("UM").ToString,
' .ClaveUnidad = drr("SATClaveUM").ToString,
' .ClaveProdServ = drr("SATClaveProdServ").ToString,
' .Noidentificacion = drr("Noidentificacion").ToString,
' .CuentaPredial = drr("CuentaPredial").ToString}
' '' verifica suma subtotales
' If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal <> concepto.Importe Then 'proceso de ajusta de decimales
' concepto.Importe = totSubTotal
' End If
' totSubTotal = totSubTotal - concepto.Importe
' ''siempre estaremos agregando el iva, auqnue sea en importe cero o tasa cero, para que se emita la factura
' If drr("ImporteIVA").ToString.ToDouble > 0 Then
' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIVA").ToString.ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString.ToDecimal})
' End If
' If drr("ImporteIEPS").ToString.ToDouble > 0 Then
' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = drr("PorcentajeIEPS").ToString.ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString.ToDecimal})
' End If
' If drr("ImporteRetIVA").ToString.ToDouble > 0 Then 'si hay retenciones
' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetIVA, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString.ToDecimal})
' End If
' If drr("ImporteRetISR").ToString.ToDouble > 0 Then 'retención de ISR
' concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = concepto.Importe - concepto.Descuento, .TasaOCuota = TasaRetISR, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString.ToDecimal})
' End If
' Timbre.Conceptos.Add(concepto)
' i += 1
' Next
' Dim AplicaComercioExteriorSubProyecto As Boolean = If(GlobalDTSubProyectos(-1, Obj.CveSubProyecto)(0)("AplicaComercioExterior").ToString = "True", True, False)
' Timbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto = AplicaComercioExteriorSubProyecto
' If Obj.Cliente.AplicaComercioExterior And AplicaComercioExteriorSubProyecto Then
' Timbre.Receptor.ResidenciaFiscal = Obj.Cliente.ClaveSATPais
' Timbre.Receptor.NumeroRegistroTributario = Obj.Cliente.NumRegIdTrib
' End If
' Return Timbre
'End Function
#End Region
#Region "C L I E N T E S G R I D S I M P R I M I R P D F/Excel"
Private Sub LnkCotizacionesPDF_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesPDF.Click
ImprimeGridsProveedores("PDF", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkCotizacionesExcel_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesExcel.Click
ImprimeGridsProveedores("Excel", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkCxCActivasPDF_Click(sender As Object, e As EventArgs) Handles LnkCxCActivasPDF.Click
ImprimeGridsProveedores("PDF", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkCxCActivasExcel_Click(sender As Object, e As EventArgs) Handles LnkCxCActivasExcel.Click
ImprimeGridsProveedores("Excel", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkHistorialCxCPDF_Click(sender As Object, e As EventArgs) Handles LnkHistorialCxCPDF.Click
ImprimeGridsProveedores("PDF", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkHistorialCxCExcel_Click(sender As Object, e As EventArgs) Handles LnkHistorialCxCExcel.Click
ImprimeGridsProveedores("Excel", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkAnticipoClientePDF_Click(sender As Object, e As EventArgs) Handles LnkAnticipoClientePDF.Click
ImprimeGridsProveedores("PDF", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkAnticipoClienteExcel_Click(sender As Object, e As EventArgs) Handles LnkAnticipoClienteExcel.Click
ImprimeGridsProveedores("Excel", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkAnticipoHistorialPDF_Click(sender As Object, e As EventArgs) Handles LnkAnticipoHistorialPDF.Click
ImprimeGridsProveedores("PDF", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkAnticipoHistorialExcel_Click(sender As Object, e As EventArgs) Handles LnkAnticipoHistorialExcel.Click
ImprimeGridsProveedores("Excel", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkCuentasBancariasPDF_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancariasPDF.Click
ImprimeGridsProveedores("PDF", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub LnkCuentasBancariasExcel_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancariasExcel.Click
ImprimeGridsProveedores("Excel", DTCobrosRealizados, "RepClientesCotizaciones")
End Sub
Private Sub ImprimeGridsProveedores(Formato As String, DtTemp As DataTable, NombreFormato As String)
If DtTemp IsNot Nothing And DtTemp.Rows.Count > 0 Then
Dim params As New List(Of ReportParameter)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("AgrupadoPor", "Cliente: " & LtlCliente.Text))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
ImprimirPDF("Empresas\Grales\Formatos\" & NombreFormato & ".rdlc", DtTemp, params, NombreFormato & "_" & Now.ToString("yyyyMMddhhmmss"), Formato:=Formato)
Else
Alert("No se encontró información.", TipoMensaje.MsgAdvertencia)
End If
End Sub
#End Region
End Class