This commit is contained in:
2019-10-28 16:22:36 -07:00
parent 99cc487117
commit b79d46a4b4
3 changed files with 72 additions and 53 deletions

View File

@@ -1160,9 +1160,20 @@ Partial Class Inventarios_EntradasSalidas
Protected Sub AddNew(CvePS As Integer, PS As String, CveUM As Integer, UM As String, Cantidad As Double, PU As Double, SerieLote As String, CodigoAF As String, Codigo As String, CveAF As String, Observaciones As String, Lote As String, Batch As String, CveSeccionAlmacen As Integer, SeccionAlmacen As String) Protected Sub AddNew(CvePS As Integer, PS As String, CveUM As Integer, UM As String, Cantidad As Double, PU As Double, SerieLote As String, CodigoAF As String, Codigo As String, CveAF As String, Observaciones As String, Lote As String, Batch As String, CveSeccionAlmacen As Integer, SeccionAlmacen As String)
If DdlAlmacen.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlProducto2.SelectedText = "" : Exit Sub If DdlAlmacen.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgAdvertencia) : RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") : DdlProducto2.SelectedText = "" : Exit Sub
Dim Valido As Boolean = True Dim Valido As Boolean = True
Dim RowPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0)
Dim CveMetodoInventario As Integer = RowPS("Inv_CveMetodoInventario").ToString().ToEntero()
If CveMetodoInventario = 5 And (String.IsNullOrEmpty(SerieLote.Trim()) OrElse SerieLote = "-1") Then
Valido = False
Alert("El producto requiere Serie-Lote", TipoMensaje.MsgAdvertencia)
End If
'salida 'salida
If DdlConcepto.SelectedValue.Contiene({"3", "5", "7", "8", "11", "12", "13", "15", "16", "17", "20", "21", "30", "31"}) Then ' salida de almacen If Valido AndAlso DdlConcepto.SelectedValue.Contiene({"3", "5", "7", "8", "11", "12", "13", "15", "16", "17", "20", "21", "30", "31"}) Then ' salida de almacen
Dim Existencia As Double = GetExistencias(CvePS, CveUM, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, If(SerieLote = "", "-1", SerieLote), If(Lote = "", "-1", Lote), If(Batch = "", "-1", Batch)) Dim Existencia As Double = GetExistencias(CvePS, CveUM, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, If(SerieLote = "", "-1", SerieLote), If(Lote = "", "-1", Lote), If(Batch = "", "-1", Batch))
LbAgregar.ToolTip = Existencia.ToString LbAgregar.ToolTip = Existencia.ToString
If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUM} {If(SerieLote <> "", $" AND SerieLote = '{SerieLote}'", "")}") < 0 Then If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUM} {If(SerieLote <> "", $" AND SerieLote = '{SerieLote}'", "")}") < 0 Then
@@ -1181,6 +1192,7 @@ Partial Class Inventarios_EntradasSalidas
End If End If
End If End If
If Valido Then If Valido Then
Dim CveClasificacion As Integer Dim CveClasificacion As Integer
Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimero("", "PS") Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimero("", "PS")

View File

@@ -2882,13 +2882,15 @@ Partial Class OC
Promocion = TxtPromocion.Text.Trim Promocion = TxtPromocion.Text.Trim
Try Try
If ChkCotizacion.Checked AndAlso gvCotizaciones.Rows.Count > 0 AndAlso (NumCotizacionesGanadoras > 0 OrElse Not (NumCotizacionesGanadoras <= 0 AndAlso CveConfianzaProveedor = 1)) Then Dim NoProveedoresCot As Integer = DtDetalle.COUNT("CveProveedor", "CveProveedor > 0")
If ChkCotizacion.Checked AndAlso NoProveedoresCot > 0 AndAlso (NumCotizacionesGanadoras > 0 OrElse Not (NumCotizacionesGanadoras <= 0 AndAlso CveConfianzaProveedor = 1)) Then
Dim CveProveedor = -1 Dim CveProveedor = -1
Dim TotalCot = 0.0, IVACot = 0D, RetIVA = 0.0, RetISR = 0.0, PorIVA = 0.0, Porcentaje = 0.0 Dim TotalCot = 0.0, IVACot = 0D, RetIVA = 0.0, RetISR = 0.0, PorIVA = 0.0, Porcentaje = 0.0
Dim IdPoliza = -1 Dim IdPoliza = -1
For Each dr As DataRow In DtDetalle.FiltraParametros("", "CveProveedor").Rows For Each dr As DataRow In DtDetalle.FiltraParametros("CveProveedor > 0", "CveProveedor").Rows
'SI ES DIFERENTE PROVEEDOR AGREGA UNA OC 'SI ES DIFERENTE PROVEEDOR AGREGA UNA OC
If CveProveedor <> dr("CveProveedor").ToString.ToEntero Then If CveProveedor <> dr("CveProveedor").ToString.ToEntero Then

View File

@@ -122,57 +122,62 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
sb.AppendFormat("Es Cancelable: {0} <br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable); sb.AppendFormat("Es Cancelable: {0} <br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable);
sb.AppendFormat("Estatus de Cancelación: {0} <br/><br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion); sb.AppendFormat("Estatus de Cancelación: {0} <br/><br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion);
//var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje; if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test")))
{
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
//sb.AppendFormat("{0} <br/>", FueCancelado); sb.AppendFormat("{0} <br/>", FueCancelado);
//if (CveEstatus.Contiene(4, 5) && EsRefacturacion) if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
//{ {
// Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta)); Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
//} }
}
if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE")) else
{ {
sb.Append("Esta factura no es cancelable."); if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE"))
return sb.ToString(); {
} sb.Append("Esta factura no es cancelable.");
return sb.ToString();
if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO") }
{
CveEstatus = 5;
var solicitud = new WSGF.Service1SoapClient();
var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
if (acuse.Estado == 0)
{
var xmlAcuse = new System.Xml.XmlDocument();
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
}
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion).Mensaje;
sb.AppendFormat("{0} <br/>", FueCancelado); if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO")
if (CveEstatus.Contiene(4, 5) && EsRefacturacion) {
{ CveEstatus = 5;
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta)); var solicitud = new WSGF.Service1SoapClient();
} var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
}
else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA") if (acuse.Estado == 0)
{ {
//ASIGNAMOS ESTATUS EMITIDA var xmlAcuse = new System.Xml.XmlDocument();
CveEstatus = 3; xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
var ObjVentas = new ClsVentas();
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa)) CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
{ CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
sb.Append("El estatus de la factura fue cambiado a 'Emitida'."); }
}
else var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion).Mensaje;
{
sb.Append("Ocurrió un error al cambiar el estatus de la factura."); sb.AppendFormat("{0} <br/>", FueCancelado);
} if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
ObjVentas.Dispose(); {
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
}
}
else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA")
{
//ASIGNAMOS ESTATUS EMITIDA
CveEstatus = 3;
var ObjVentas = new ClsVentas();
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
{
sb.Append("El estatus de la factura fue cambiado a 'Emitida'.");
}
else
{
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
}
ObjVentas.Dispose();
}
} }
} }
else else