// Rechazar solicitud de anulacion public void RechazarAnulacion(ComprobanteModel comprobante, string userName) { ComprobanteDetalle cdService = new ComprobanteDetalle(); IPartidas parService = new Partidas(); comprobante.TC_ESTATUS = Convert.ToInt16(BusinessEnumerations.EstatusCarga.CONCILIADO).ToString(); comprobante.TC_FECHA_RECHAZO = DateTime.Now; comprobante.TC_USUARIO_RECHAZO = userName; comprobante.TC_USUARIO_RECHAZO_ANULACION = userName; comprobante.TC_FECHA_RECHAZO_ANULACION = DateTime.Now; //Prueba //using (var trx = new TransactionScope()) //{ // using (var db = new DBModelEntities()) // { // var detalles = cdService.GetAll(c => c.TC_ID_COMPROBANTE == comprobante.TC_ID_COMPROBANTE).ToList(); // detalles.ForEach(c => // { // var clonePart = c.SAX_PARTIDAS.CloneEntity(); // var partEntity = c.SAX_PARTIDAS; // clonePart.PA_FECHA_ANULACION = null; // clonePart.PA_USUARIO_ANULACION = null; // parService.Update(partEntity, clonePart); // }); // } // trx.Complete(); //} base.Update(comprobante); }
public ActionResult DeleteConfirmed(int id) { ComprobanteDetalle comprobanteDetalle = db.ComprobanteDetalle.Find(id); db.ComprobanteDetalle.Remove(comprobanteDetalle); db.SaveChanges(); return(RedirectToAction("Index")); }
private void LoadMainDg(ComprobanteDetalle comprobanteDetalle) { maindg.Rows.Add( comprobanteDetalle.linea, comprobanteDetalle.Articulo.BarraDesc, comprobanteDetalle.cantidad, 0 ); }
public void RetirarItemDeDetalle() { if (ComprobanteDetalle.Count > 0) { var detalleARetirar = ComprobanteDetalle.Where(x => x.Retirar) .SingleOrDefault(); ComprobanteDetalle.Remove(detalleARetirar); } }
public void AgregarItemADetalle() { ComprobanteDetalle.Add(new ComprobanteDetalleViewModel { ProductoId = CabeceraProductoId, ProductoNombre = CabeceraProductoNombre, PrecioUnitario = CabeceraProductoPrecio, Cantidad = CabeceraProductoCantidad, }); }
public ActionResult Edit([Bind(Include = "id,ComprobanteId,ProductoId,Cantidad,PrecioUnitario,Monto")] ComprobanteDetalle comprobanteDetalle) { if (ModelState.IsValid) { db.Entry(comprobanteDetalle).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ComprobanteId = new SelectList(db.Comprobante, "id", "Cliente", comprobanteDetalle.ComprobanteId); ViewBag.ProductoId = new SelectList(db.Producto, "id", "Nombre", comprobanteDetalle.ProductoId); return(View(comprobanteDetalle)); }
private void LoadScandg(ComprobanteDetalle comprobanteDetalle, int cantidad) { for (int i = 1; i <= cantidad; i++) { scandg.Rows.Add ( scandg.RowCount + 1, comprobanteDetalle.Articulo.Codigo_fs, ((TipoRechazo)reasoncb.SelectedItem).Descripcion, _traductorUsuario.Traducir(ConstantesTexto.Suprimir) ); } }
// GET: ComprobanteDetalles/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ComprobanteDetalle comprobanteDetalle = db.ComprobanteDetalle.Find(id); if (comprobanteDetalle == null) { return(HttpNotFound()); } return(View(comprobanteDetalle)); }
// GET: ComprobanteDetalles/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ComprobanteDetalle comprobanteDetalle = db.ComprobanteDetalle.Find(id); if (comprobanteDetalle == null) { return(HttpNotFound()); } ViewBag.ComprobanteId = new SelectList(db.Comprobante, "id", "Cliente", comprobanteDetalle.ComprobanteId); ViewBag.ProductoId = new SelectList(db.Producto, "id", "Nombre", comprobanteDetalle.ProductoId); return(View(comprobanteDetalle)); }
private void LoadScan(DataGridViewCell cell, ComprobanteDetalle detalle) { int cant = 0; if (completecb.Checked) { cant = detalle.cantidad - Convert.ToInt32(cell.Value); cell.Value = detalle.cantidad; } else { cant = 1; cell.Value = Convert.ToInt32(cell.Value) + 1; } LoadScandg(detalle, cant); LoadComp(detalle, cant); }
public async Task <long> GenerarComprobante(ComprobanteForRegister command) { Preliquidacion entity; Comprobante comprobante; ComprobanteDetalle comprobantedetalle; using (var transaction = _context.Database.BeginTransaction()) { entity = await _context.Preliquidacion.Where(x => x.Id == command.PreliquidacionId).SingleOrDefaultAsync(); // entity_detalles = await _context.PreliquidacionDetalle.Where(x=>x.PreliquidacionId == command.PreliquidacionId).ToListAsync(); comprobante = new Comprobante(); comprobante.Igv = entity.Igv; comprobante.NumeroComprobante = "001-005498"; comprobante.PreliquidacionId = command.PreliquidacionId; comprobante.SubTotal = entity.SubTotal; comprobante.TipoComprobanteId = 1; comprobante.Total = entity.Total; comprobante.UsuarioRegistroId = 1; await _context.AddAsync <Comprobante>(comprobante); await _context.SaveChangesAsync(); // foreach (var item in entity_detalles) // { comprobantedetalle = new ComprobanteDetalle(); comprobantedetalle.ComprobanteId = comprobante.Id; comprobantedetalle.Descripcion = "Por almacenamiento"; comprobantedetalle.Subtotal = entity.SubTotal; comprobantedetalle.Total = entity.Total; comprobantedetalle.Igv = entity.Igv; await _context.AddAsync <ComprobanteDetalle>(comprobantedetalle); await _context.SaveChangesAsync(); // } transaction.Commit(); } return(1); }
private void LoadComp(ComprobanteDetalle comprobanteDetalle, int cantidad) { foreach (DataGridViewRow row in receiptdg.Rows) { if (row.Cells[0].Value.Equals(comprobanteDetalle.Articulo.Codigo_fs) && row.Cells[1].Value.Equals(((TipoRechazo)reasoncb.SelectedItem).ID)) { row.Cells[2].Value = Convert.ToInt32(row.Cells[2].Value) + cantidad; return; } } receiptdg.Rows.Add ( comprobanteDetalle.Articulo.Codigo_fs, ((TipoRechazo)reasoncb.SelectedItem).ID, cantidad, comprobanteDetalle.Articulo_ID ); }
public bool ExisteEnDetalle(int ProductoId) { return(ComprobanteDetalle.Any(x => x.ProductoId == ProductoId)); }
public void Update(int IdComprobante, JObject data) { try { Comprobante entity = data["entity"].ToObject <Comprobante>(); List <ComprobanteDetalle> listEntity = data["listEntity"].ToObject <List <ComprobanteDetalle> >(); SiinErpContext context = new SiinErpContext(); using (var tran = context.Database.BeginTransaction()) { entity.FechaDoc = entity.FechaDoc.ToOffset(new TimeSpan(-5, 0, 0)); Comprobante ob = context.Comprobantes.Find(IdComprobante); if (ob.FechaDoc != entity.FechaDoc) { ob.FechaDoc = entity.FechaDoc; ob.Periodo = entity.Periodo; ob.ModificadoPor = entity.ModificadoPor; ob.FechaModificado = DateTimeOffset.Now; context.SaveChanges(); } foreach (ComprobanteDetalle d in listEntity) { switch (d.Modo) { case "A": { d.IdDetalleComprobante = 0; d.IdComprobante = entity.IdComprobante; d.FechaCreacion = DateTimeOffset.Now; context.ComprobantesDetalles.Add(d); context.SaveChanges(); break; } case "E": { ComprobanteDetalle entityDet = context.ComprobantesDetalles.Find(d.IdDetalleComprobante); entityDet.Detalle = d.Detalle; entityDet.IdCuentaContable = d.IdCuentaContable; entityDet.IdTercero = d.IdTercero; entityDet.DebCred = d.DebCred; entityDet.IdDetCenCosto = d.IdDetCenCosto; entityDet.IdRetencion = d.IdRetencion; entityDet.Valor = d.Valor; entityDet.ModificadoPor = entity.ModificadoPor; entityDet.FechaModificado = DateTimeOffset.Now; context.SaveChanges(); break; } case "X": { ComprobanteDetalle entityDet = context.ComprobantesDetalles.Find(d.IdDetalleComprobante); entityDet.Estado = Constantes.EstadoInactivo; entityDet.ModificadoPor = entity.ModificadoPor; entityDet.FechaModificado = DateTimeOffset.Now; context.SaveChanges(); break; } } } tran.Commit(); } } catch (Exception ex) { errorBusiness.Create("UpdateComprobantesContab", ex.Message, null); throw; } }