VYAa remision presupuestal Rep contratos y detalle
This commit is contained in:
@@ -343,6 +343,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-md-4">Es Presupuestal</label>
|
||||
<div class="col-md-8">
|
||||
<asp:CheckBox runat="server" ID="ChkEsPresupuestal" CssClass="make-switchsd" data-size="small" Checked="true" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center; padding-top: 20px;">
|
||||
|
||||
@@ -254,6 +254,8 @@ Partial Class RepContratoDetalle
|
||||
|
||||
If CveVentaRemision > 0 Then
|
||||
DVFactura.Visible = True
|
||||
ChkEsPresupuestal.Enabled = False
|
||||
ChkEsPresupuestal.Checked = False
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -326,6 +328,8 @@ Partial Class RepContratoDetalle
|
||||
HypRemision.Text = Contrato.Rows(0)("RemisionSerieFolio").ToString
|
||||
HypRemision.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={ CveVentaRemision}"
|
||||
|
||||
ChkEsPresupuestal.Checked = Boolean.Parse(Contrato.Rows(0)("EsPresupuestal").ToString)
|
||||
|
||||
If Contrato.Rows(0)("RemisionSaldo").ToString.ToDecimal > 0 Then
|
||||
LblSaldo.Text = $"Saldo { Contrato.Rows(0)("RemisionSaldo").ToString.ToDecimal.ToString("###,###,###.00")}"
|
||||
Else
|
||||
@@ -449,22 +453,7 @@ Partial Class RepContratoDetalle
|
||||
|
||||
End Sub
|
||||
|
||||
'Protected Sub CargarArchivo(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AFU.UploadedComplete
|
||||
' If AFU.HasFile Then
|
||||
|
||||
|
||||
' Dim UploadFolder As String = String.Format("{0}\Temp\", UsuarioActual.Empresa.Ruta)
|
||||
' UploadFolder.DirectoryExistsCreate()
|
||||
' Dim Extension As String = System.IO.Path.GetExtension(AFU.PostedFile.FileName)
|
||||
|
||||
' If File.Exists(String.Format("{0}{1}{2}", UploadFolder, UsuarioActual.CveUsuario.ToString, Extension)) Then File.Delete(String.Format("{0}{1}{2}", UploadFolder, UsuarioActual.CveUsuario.ToString, Extension))
|
||||
|
||||
' AFU.SaveAs(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension)
|
||||
' Session("FileUpload") = UploadFolder & UsuarioActual.CveUsuario.ToString & Extension
|
||||
' Session("FileExtension") = Extension
|
||||
' Session("FileFolder") = UploadFolder
|
||||
' End If
|
||||
'End Sub
|
||||
Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument)
|
||||
Dim Archivo As New System.IO.FileInfo(filePath)
|
||||
@@ -526,16 +515,8 @@ Partial Class RepContratoDetalle
|
||||
BtnDescargar.Visible = True
|
||||
End If
|
||||
End Sub
|
||||
'Private Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click
|
||||
' Dim File As New FileInfo(ViewState("FUrl").ToString)
|
||||
' Dim Url As String = $"{ObtenerUrlCompleta()}Compras/PopUpVerFactura.aspx?ArchivoContrato={Encripta(File.FullName)}"
|
||||
' If File.Exists Then
|
||||
' RegistraScript($"window.open({Url}, ""_blank"");")
|
||||
' End If
|
||||
|
||||
|
||||
'End Sub
|
||||
|
||||
Public Function ObtenerUrlCompleta() As String
|
||||
|
||||
Dim Solicitud As HttpRequest = HttpContext.Current.Request
|
||||
@@ -555,31 +536,7 @@ Partial Class RepContratoDetalle
|
||||
Return url
|
||||
|
||||
End Function
|
||||
'Private Sub DescargaArchivo(urlArchivo As String)
|
||||
|
||||
' Dim File As New FileInfo(urlArchivo)
|
||||
|
||||
' If File.Exists Then 'set appropriate headers
|
||||
|
||||
' Response.Clear()
|
||||
' Response.ClearHeaders()
|
||||
' Response.ClearContent()
|
||||
' Response.AddHeader("Content-Disposition", "inline; filename=" & TxtFolio.Text & $"{File.Extension}")
|
||||
' Response.AddHeader("Content-Length", File.Length.ToString())
|
||||
' 'Response.ContentType = "text/plain"
|
||||
' Response.ContentType = "application/octet-stream"
|
||||
' Response.Flush()
|
||||
' ' Response.TransmitFile(File.FullName)
|
||||
' Response.WriteFile(File.FullName)
|
||||
' Response.End()
|
||||
|
||||
' Else
|
||||
|
||||
' Alert("Ocurrio un error al descargar el archivo", TipoMensaje.MsgAdvertencia, "window.close()")
|
||||
|
||||
' End If
|
||||
|
||||
'End Sub
|
||||
|
||||
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
|
||||
Dim ArchivoUpdate As String = "-1"
|
||||
@@ -597,7 +554,7 @@ Partial Class RepContratoDetalle
|
||||
|
||||
|
||||
If Not ObjContratos.UpdateContratos(CveContrato, TxtFolio.Text, TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "",
|
||||
DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, -1, ArchivoUpdate, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal,
|
||||
DdlSubProyecto.SelectedValue.ToEntero, -1, -1, -1, -1, ArchivoUpdate, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, ChkEsPresupuestal.Checked, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal,
|
||||
DdlMoneda.SelectedValue.ToEntero, 0, CveContratoTipo:=CveContratoTipo, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CveContratosEstatus:=CveContratoEstatus, Observaciones:=TxtObservaciones.Text) Then
|
||||
ErrorProceso = True
|
||||
End If
|
||||
@@ -617,6 +574,24 @@ Partial Class RepContratoDetalle
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ErrorProceso AndAlso Not CveVentaRemision > 0 AndAlso ChkEsPresupuestal.Checked = False Then
|
||||
'CveVentaRemision
|
||||
Dim ObsRemisionPartida As String = $"{DdlTipoAF.SelectedItem.Text}-{ TxtDescripcion.Text}-{TxtFolio.Text}"
|
||||
|
||||
Dim Respuesta As New RespuestaFacturacion()
|
||||
Dim CvePS As Integer = 907784
|
||||
Respuesta = GeneraRemision(CveContrato, ObsRemisionPartida, TxtImporte.Text.ToDecimal, CvePS, ObjContratos.IniciaTransacSQL, DdlSubProyecto.SelectedValue.ToEntero)
|
||||
|
||||
If Respuesta.CveVenta > 0 Then
|
||||
CveVentaRemision = Respuesta.CveVenta
|
||||
'SerieFolioRemision = Respuesta.SerieFolio
|
||||
ErrorProceso = False
|
||||
Else
|
||||
ErrorProceso = True
|
||||
Alert("se presento un error al generar la remisión", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ErrorProceso Then
|
||||
|
||||
ObjContratos.Commit()
|
||||
@@ -796,23 +771,7 @@ Partial Class RepContratoDetalle
|
||||
New ReportParameter("FechaImpresion", Date.Now.ToString("dd/MM/yyyy HH:mm:ss")),
|
||||
New ReportParameter("Usuario", UsuarioActual.Nombre)
|
||||
}
|
||||
'New ReportParameter("Folio", TxtFolio.Text),
|
||||
' New ReportParameter("Cliente", DdlClientes.SelectedText),
|
||||
' New ReportParameter("Servicio", TxtDescripcion.Text),
|
||||
' New ReportParameter("Observaciones", TxtObservaciones.Text),
|
||||
' New ReportParameter("Ubicacion", TxtUbicacion.Text),
|
||||
' New ReportParameter("FechaSalida", TxtFechaSalida.Text.ToDate.ToString("dd/MM/yyyy")),
|
||||
' New ReportParameter("FechaRegreso", TxtFechaRegreso.Text.ToDate.ToString("dd/MM/yyyy")),
|
||||
' New ReportParameter("CantidadPasajeros", TxtCantidadPasajeros.Text),
|
||||
' New ReportParameter("TipoAF", DdlTipoAF.SelectedItem.ToString()),
|
||||
' New ReportParameter("Pesos", Math.Round(TxtImporte.Text.ToDecimal, 2).ToString),
|
||||
' New ReportParameter("Moneda", DdlMoneda.SelectedItem.ToString),
|
||||
' New ReportParameter("Anticipo", Math.Round((TxtAnticipo.Text.ToDecimal * TxtImporte.Text.ToDecimal), 2).ToString),
|
||||
' New ReportParameter("Total", Math.Round((TxtImporte.Text.ToDecimal - (TxtAnticipo.Text.ToDecimal * TxtImporte.Text.ToDecimal)), 2).ToString),
|
||||
' New ReportParameter("DiaSalida", $"{TxtFechaSalida.Text.ToDate.Hour}:{TxtFechaSalida.Text.ToDate.Minute} "),
|
||||
' New ReportParameter("TelefonoEmpresa", TelefonoEmpresa),
|
||||
' New ReportParameter("FechaImpresion", Date.Now.ToString("dd/MM/yyyy HH:mm:ss")),
|
||||
' New ReportParameter("Usuario", UsuarioActual.Nombre)
|
||||
|
||||
|
||||
ImprimirPDFStimul($"{UsuarioActual.Empresa.Ruta}Formatos\Contrato.mrt", dtResult, params, NombreArchivo:=TxtFolio.Text)
|
||||
End Sub
|
||||
@@ -1114,7 +1073,85 @@ Partial Class RepContratoDetalle
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " R E M I S I O N "
|
||||
Private Function GeneraRemision(CveContrato As Integer, ObsPartida As String, Importe As Decimal, CvePS As Integer, ByRef TransaccionSQL As SqlClient.SqlTransaction, CveSubProyecto As Integer) As RespuestaFacturacion
|
||||
|
||||
Dim Respuesta As New RespuestaFacturacion()
|
||||
Dim CveRemisionGenerada As Integer = -1
|
||||
Dim ObjVentas As New ClsVentas(TransaccionSQL)
|
||||
Dim ProcesoOK As Boolean = True
|
||||
Dim CveMoneda As Integer = DdlMoneda.SelectedValue.ToEntero
|
||||
|
||||
Dim ObjFactura As Modelos.Factura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyecto, DdlClientes.SelectedValue.ToEntero, CveMoneda, "Rem")
|
||||
|
||||
If ObjFactura IsNot Nothing AndAlso ProcesoOK Then
|
||||
|
||||
ObjFactura.CveMoneda = CveMoneda
|
||||
ObjFactura.CveContrato = CveContrato
|
||||
ObjFactura.Observaciones = ObsPartida
|
||||
ObjFactura.CveFormaPago33 = 20 ' por definir
|
||||
If CveMoneda > 1 Then
|
||||
ObjFactura.TipoCambio = GlobalTipoCambio(DateTime.Now).ToDecimal
|
||||
End If
|
||||
|
||||
Dim TmpDTMat As New DataTable
|
||||
TmpDTMat.Columns.Add("Consec", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("CvePS", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("CveUM", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("Cantidad", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("PU", GetType(Decimal))
|
||||
TmpDTMat.Columns.Add("Lote", GetType(String))
|
||||
TmpDTMat.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
TmpDTMat.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
|
||||
Dim CantidadRegistro As Decimal = 1
|
||||
Dim PorcentajeIVA As Decimal = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyecto).FiltroPrimeroValor("IVA").ToDecimal
|
||||
Dim SubTotal As Decimal = (Importe / (1D + PorcentajeIVA))
|
||||
Dim PU As Decimal = SubTotal
|
||||
Dim Descuento As Decimal = 0
|
||||
Dim Obs As String = ObsPartida
|
||||
|
||||
If CantidadRegistro > 0 Then
|
||||
If ObjFactura.AgregarPS(CvePS, CantidadRegistro, PU, Descuento, Obs, CveSubProyecto:=CveSubProyecto, PorcentajeIVA:=PorcentajeIVA) Then
|
||||
Dim drp As DataRow = TmpDTMat.NewRow
|
||||
drp("CvePS") = CvePS
|
||||
drp("Cantidad") = CantidadRegistro
|
||||
drp("PU") = PU
|
||||
TmpDTMat.Rows.Add(drp)
|
||||
Else
|
||||
Alert("Error al agregar producto", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
ObjFactura.CalculaTotales()
|
||||
Dim Resp As New Modelos.Factura.MMensajeFactura
|
||||
Resp = ObjFactura.EmitirFactura(False, Transac:=TransaccionSQL)
|
||||
|
||||
If Resp.CveVenta > 0 Then
|
||||
Respuesta.CveVenta = Resp.CveVenta
|
||||
Respuesta.SerieFolio = Resp.SerieFolio
|
||||
Respuesta.dtdetalle = TmpDTMat
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
Return Respuesta
|
||||
|
||||
End Function
|
||||
Friend Class RespuestaFacturacion
|
||||
Public Property CveVenta As Integer = -1
|
||||
Public Property SerieFolio As String = "-1"
|
||||
Public Property dtdetalle As DataTable = Nothing
|
||||
Public Sub New()
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
@@ -257,14 +257,10 @@
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row my-1">
|
||||
<label class="col-md-4 bold text-primary">Folio</label>
|
||||
<%--<asp:Label class="col-md-8" runat="server" ID="LbFolio" Text="Folio"></asp:Label>--%>
|
||||
<label class="col-md-4 bold text-primary">Folio</label>
|
||||
<div class="col-md-8">
|
||||
|
||||
<asp:TextBox ID="LbFolio" runat="server" MaxLength="70" Width="200px" CssClass="form-control" ></asp:TextBox>
|
||||
|
||||
|
||||
</div>
|
||||
<asp:TextBox ID="LbFolio" runat="server" MaxLength="70" Width="200px" CssClass="form-control"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row my-1">
|
||||
@@ -488,6 +484,15 @@
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
<div class="row my-1">
|
||||
<label class="col-md-4">Es Presupuestal</label>
|
||||
<div class="col-md-8">
|
||||
<asp:CheckBox runat="server" ID="ChkEsPresupuestal" CssClass="make-switchsd" data-size="small" Checked="true" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -137,7 +137,7 @@ Partial Class ListadoContratos
|
||||
Dim ObjFolios As New ClsGralFolios(ObjContratos.IniciaTransacSQL())
|
||||
|
||||
CveContrato = ObjContratos.AddContratos(LbFolio.Text, TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDateTime, TxtFechaRegreso.Text.ToDateTime, TxtUbicacion.Text, "",
|
||||
DdlSubProyectoModal.SelectedValue.ToEntero, -1, -1, -1, -1, LbArchivo.Text, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal,
|
||||
DdlSubProyectoModal.SelectedValue.ToEntero, -1, -1, -1, -1, LbArchivo.Text, "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, ChkEsPresupuestal.Checked, TxtAnticipo.Text.ToDecimal, -1, TxtImporte.Text.ToDecimal,
|
||||
DdlMoneda.SelectedValue.ToEntero, 0, CveContratoTipo:=34, CveContratosEstatus:=50, CveTipoAF:=DdlTipoAF.SelectedValue.ToEntero, CantidadPasajeros:=TxtCantidadPasajeros.Text.ToEntero, Observaciones:=TxtObservaciones.Text,
|
||||
CveVendedor:=UsuarioActual.CveVendedor)
|
||||
|
||||
@@ -180,7 +180,7 @@ Partial Class ListadoContratos
|
||||
End If
|
||||
Anexo.Text = ""
|
||||
|
||||
If ErrorProceso = False Then
|
||||
If ErrorProceso = False AndAlso Not ChkEsPresupuestal.Checked Then
|
||||
|
||||
Dim ObsRemisionPartida As String = $"{DdlTipoAF.SelectedItem.Text}-{ TxtDescripcion.Text}-{LbFolio.Text}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user