public InvoiceDocument(Waybill waybill) { doc.PagePadding = new Thickness(29); ((IDocumentPaginatorSource)doc).DocumentPaginator.PageSize = new Size(1069, 756); this.waybill = waybill; BlockStyle = new Style(typeof(Paragraph)) { Setters = { new Setter(Control.FontSizeProperty, 10d), new Setter(System.Windows.Documents.Block.MarginProperty, new Thickness(0, 3, 0, 3)) } }; HeaderStyle = new Style(typeof(Run), HeaderStyle) { Setters = { new Setter(Control.FontSizeProperty, 12d), } }; TableHeaderStyle = new Style(typeof(TableCell), TableHeaderStyle) { Setters = { new Setter(Control.FontSizeProperty, 10d), } }; }
public async Task <IActionResult> PostWaybill([FromBody] Waybill waybill) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var numberPlate = (from x in _context.Vehicles where x.Vehicle_Registration_Number == waybill.Vehicle_Registration_Number select x.Vehicle_Number_Plate).Single(); Waybill obj = new Waybill(); obj.WaybillId = waybill.WaybillId; obj.Waybill_Total_weight = waybill.Waybill_Total_weight; obj.Waybil_Total_Parcels_Allocated = waybill.Waybil_Total_Parcels_Allocated; obj.Vehicle_Registration_Number = waybill.Vehicle_Registration_Number; obj.Vehicle_Number_Plate = numberPlate.ToString(); _context.Waybill.Add(obj); await _context.SaveChangesAsync(); return(CreatedAtAction("GetWaybill", new { id = waybill.WaybillId }, waybill)); }
public void Mark_waybill_with_reject() { var reject = localSession.Query <Client.Models.Reject>().First(); var waybill = new Waybill(address, localSession.Query <Supplier>().First()); waybill.AddLine(new WaybillLine(waybill) { Product = reject.Product, ProductId = reject.ProductId, SerialNumber = reject.Series, SupplierCost = 42.90m, SupplierCostWithoutNds = 36.36m, Nds = 18, ProducerCost = 28.78m, Quantity = 10 }); localSession.Save(waybill); var cmd = new UpdateCommand(); cmd.Session = localSession; cmd.CalculateRejects(settings); localSession.Refresh(waybill); Assert.IsTrue(waybill.IsRejectChanged, waybill.Id.ToString()); var line = waybill.Lines[0]; localSession.Refresh(line); Assert.IsTrue(line.IsRejectNew); Assert.AreEqual(reject.Id, line.RejectId, line.Id.ToString()); }
public void SpecialMarkup_Waybill() { var waybill = new Waybill(address, session.Query <Supplier>().First()); var catalog = session.Query <Catalog>().First(); var product = session.Query <Product>().First(x => x.CatalogId == catalog.Id); var line = new WaybillLine(waybill) { ProductId = product.Id, CatalogId = catalog.Id, Quantity = 10, Nds = 10, ProducerCost = 15.13m, SupplierCostWithoutNds = 18.25m, SupplierCost = 20.8m }; waybill.AddLine(line); session.Save(waybill); var markup = settings.Markups.First(x => x.Type == MarkupType.Special); markup.Markup = 50; session.Save(new SpecialMarkupCatalog { CatalogId = waybill.Lines[0].CatalogId.Value }); var model = Open(new WaybillDetails(waybill.Id)); var waybillLine = model.Waybill.Lines[0]; Assert.AreEqual(30.8, waybillLine.RetailCost); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerName,CustomerAddress,CustomerNumber,TotalWeight,NoParcels,TotalValue")] Waybill waybill) { if (id != waybill.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(waybill); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WaybillExists(waybill.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(waybill)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ShipModeId,WaybillStatusId,From,To,Cost,DepartureTime,ArrivalTime,Comment,Created,Modified")] Waybill waybill) { if (id != waybill.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(waybill); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WaybillExists(waybill.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ShipModeId"] = new SelectList(_context.ShipModes, "Id", "Id", waybill.ShipModeId); ViewData["WaybillStatusId"] = new SelectList(_context.WaybillStatuses, "Id", "Id", waybill.WaybillStatusId); return(View(waybill)); }
public static WaybillsGetResponse MapToResponse(Waybill waybill) { var response = new WaybillsGetResponse { DocumentNumber = waybill.Content?.Header?.DocumentNumber, DocumentDate = waybill.Content?.Header?.DocumentDate, Consignee = waybill.Content?.Header?.Consignee, Items = waybill.Content?.Items .Select(MapToResponse) .ToArray(), TotalSumWithoutVat = waybill.Content?.Totals?.TotalSumWithoutVat, TotalSumWithVat = waybill.Content?.Totals?.TotalSumWithVat, TotalVatSum = waybill.Content?.Totals?.TotalVatSum, }; if (waybill is PaperWaybill paperWaybill) { response.ValidationResult = paperWaybill.StructuralValidationResult?.MapToResponse(); } return(response); }
public async Task <IActionResult> PutWaybill([FromRoute] int id, [FromBody] Waybill waybill) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != waybill.WaybillId) { return(BadRequest()); } _context.Entry(waybill).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WaybillExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public List <Waybill> ObtenerManifiestosRecientes(int idCasillero) { SqlCommand sqlcommand = GetSqlCommandInstance(ProcedimientosAlmacenados.Consultas); sqlcommand.Parameters.AddWithValue(Parametros.IdCasillero, idCasillero); sqlcommand.Parameters.AddWithValue(Parametros.Operation, 12); List <Waybill> manifiestos = new List <Waybill>(); Waybill manifiesto = null; using (SqlDataReader reader = sqlcommand.ExecuteReader()) { while (reader.Read()) { manifiesto = new Waybill(); manifiesto.Id = (int)reader["manifiesto_id"]; manifiesto.WaybillNumber = (string)reader["nrogui"]; manifiesto.ReceiptDate = (DateTime)reader["fec_recibo"]; manifiesto.WeightLB = (decimal)reader["pesolb"]; manifiesto.Pieces = (int)reader["nropaq"]; manifiesto.SenderName = (string)reader["rem_nombre"]; manifiesto.SenderPhone = (string)reader["rem_telefono"]; manifiestos.Add(manifiesto); } } DisposeCommand(sqlcommand); return(manifiestos); }
public int WaitTime(DateTime currTime, int point) { UpdateState(currTime); int timeWait = TimeToNextStay; if (NextStay == point) { return(timeWait); } else { int indexNextPoint = Waybill.FindIndex(x => x.Item1 == NextStay) + 1; int lenWay = Waybill.Count; while (NextStay != point) { timeWait += Waybill[indexNextPoint % lenWay].Item2; NextStay = Waybill[indexNextPoint % lenWay].Item1; indexNextPoint++; } LastTimeState = LastTimeState.AddMinutes(timeWait); TimeToNextStay = 0; return(timeWait); } }
public ActionResult ManagePackage(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tracking tracking = db.Trackings.Find(id); if (tracking == null) { return(HttpNotFound()); } Waybill waybill = new Waybill(); waybill.Order_ID = tracking.Order_ID; waybill.Track_ID = tracking.Track_ID; ViewBag.Trackings = tracking; ViewBag.DeliveryDate = tracking.Order.Bookings.Book_DeliveryDate.ToShortDateString(); ViewBag.PickupDate = tracking.Order.Bookings.Book_PickupDate.ToShortDateString(); ViewBag.Status_ID = new SelectList(db.Status.Where(u => !u.Status_ID.Equals(7)).ToList(), "Status_ID", "Storage_Status"); //ViewBag.Status_ID = new SelectList(db.Status, "Status_ID", "Storage_Status"); ViewBag.Order_ID = new SelectList(db.Orders, "Order_ID", "Driver_ID"); waybill.Date_Packages_CheckedIN = DateTime.Now.Date.ToShortDateString(); return(View(waybill)); }
public async Task <ActionResult <Waybill> > PostWaybill(Waybill waybill) { _context.Waybill.Add(waybill); await _context.SaveChangesAsync(); return(CreatedAtAction("GetWaybill", new { id = waybill.Id }, waybill)); }
public void Revert_value_on_incorrect_input() { var waybill = new Waybill(new Address("тест"), new Supplier()); var line = new WaybillLine(waybill); line.RetailCost = 150; waybill.AddLine(line); WpfTestHelper.WithWindow2(async w => { var grid = new DataGrid2(); grid.IsReadOnly = false; grid.AutoGenerateColumns = false; grid.Columns.Add(new DataGridTextColumnEx { Binding = new Binding("Product") }); grid.Columns.Add(new DataGridTextColumnEx { Binding = new Binding("RetailCost") }); w.Content = grid; grid.ItemsSource = waybill.Lines; await w.WaitIdle(); var cell = grid.Descendants <DataGridCell>() .First(x => x.Column == grid.Columns[1] && x.DataContext == line); Assert.IsTrue(cell.Focus()); cell.SendKey(Key.F2); Assert.IsTrue(cell.IsEditing); var input = cell.Descendants <TextBox>().First(); input.SendText("asd"); grid.SendKey(Key.Down); Assert.IsFalse(cell.IsEditing); Assert.AreEqual(150, line.RetailCost); }); }
public async Task <IActionResult> PutWaybill(Guid id, Waybill waybill) { if (id != waybill.Id) { return(BadRequest()); } _context.Entry(waybill).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WaybillExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult ManagePackageDispatch(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tracking tracking = db.Trackings.Find(id); if (tracking == null) { return(HttpNotFound()); } Waybill waybill = db.Waybills.Where(t => t.Track_ID == id).FirstOrDefault(); waybill.Order_ID = tracking.Order_ID; waybill.Track_ID = tracking.Track_ID; ViewBag.DeliveryDate = tracking.Order.Bookings.Book_DeliveryDate.ToShortDateString(); ViewBag.PickupDate = tracking.Order.Bookings.Book_PickupDate.ToShortDateString(); ViewBag.Trackings = tracking; ViewBag.Status_ID = new SelectList(db.Status, "Status_ID", "Storage_Status"); ViewBag.Order_ID = new SelectList(db.Orders, "Order_ID", "Driver_ID"); waybill.Date_Packages_CheckedOut = DateTime.Now.Date.ToShortDateString(); return(View(waybill)); }
public void Check_add_from_catalog_enabling() { user.IsStockEnabled = true; session.Save(user); var waybill = new Waybill(address, session.Query <Supplier>().First()); waybill.IsCreatedByUser = true; var line = new WaybillLine(waybill) { Quantity = 1 }; waybill.Lines.Add(line); session.Save(waybill); WpfTestHelper.WithWindow2(async w => { var model = new WaybillDetails(waybill.Id); var view = (WaybillDetailsView)Bind(model); w.Content = view; await view.WaitLoaded(); var addButton = view.Descendants <Button>().First(b => b.Name == "AddFromCatalog"); Assert.IsTrue(addButton.Visibility == Visibility.Visible); Assert.IsTrue(addButton.IsEnabled); view.Descendants <Button>().First(b => b.Name == "Stock") .RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); Assert.IsTrue(addButton.Visibility == Visibility.Visible); Assert.IsFalse(addButton.IsEnabled); }); WpfTestHelper.CleanSafeError(); }
/// <summary> /// Парсит полученный текст XML и возвращает объект накладной. /// </summary> /// <returns>Объект накладной, загруженный из XML.</returns> public Waybill GetWaybill() { int supplierID = -1, clientID = -1; DateTime docDate = new DateTime(1970, 1, 1); string number = string.Empty; try { number = XmlParser.GetTagValue(this.XmlRoot, XmlTags.NUMBER); string docDateStr = XmlParser.GetTagValue(this.XmlRoot, XmlTags.DATE); XmlNode xmlHeader = XmlParser.GetXmlNode(this.XmlRoot, XmlTags.HEAD); string supplierGln = XmlParser.GetTagValue((XmlElement)xmlHeader, XmlTags.SUPPLIER); string clientGln = XmlParser.GetTagValue((XmlElement)xmlHeader, XmlTags.BUYER); try { docDate = DateTime.Parse(docDateStr); } catch (FormatException ex) { this.Logger.WriteLog(string.Format("{0}: {1}: {2}. {3}", "Error reading document date", ex.Source, ex.Message, ex.StackTrace), LogTypes.WARNING); docDate = new DateTime(2000, 1, 1); } try { supplierID = this.SupplierRepository.GetAllEntities(). Where(s => this.Trim(s.GLN) == this.Trim(supplierGln)).FirstOrDefault().ID; } catch (NullReferenceException ex) { this.Logger.WriteLog(string.Format("{0}: {1}: {2}. {3}", "Supplier with GLN " + supplierGln + " not found", ex.Source, ex.Message, ex.StackTrace), LogTypes.WARNING); } try { clientID = this.ClientRepository.GetAllEntities(). Where(c => this.Trim(c.GLN) == this.Trim(clientGln)).FirstOrDefault().ID; } catch (NullReferenceException ex) { this.Logger.WriteLog(string.Format("{0}: {1}: {2}. {3}", "Client with GLN " + clientGln + " not found", ex.Source, ex.Message, ex.StackTrace)); } } catch (XPathException ex) { this.Logger.WriteLog(string.Format("{0}: {1}: {2}. {3}", "Error reading document", ex.Source, ex.Message, ex.StackTrace)); } Waybill result = new Waybill { ClientID = clientID, DocumentDate = docDate, DownloadDate = DateTime.Now, Number = number, SupplierID = supplierID }; return(result); }
public List <Waybill> BuscarGuias(Filter filtro) { SqlCommand sqlcommand = GetSqlCommandInstance(ProcedimientosAlmacenados.Consultas); sqlcommand.Parameters.AddWithValue(Parametros.IdCasillero, filtro.IdPobox); if (!string.IsNullOrEmpty(filtro.Waybill)) { sqlcommand.Parameters.AddWithValue(Parametros.WHR, filtro.Waybill); } if (!string.IsNullOrEmpty(filtro.Tracking)) { sqlcommand.Parameters.AddWithValue(Parametros.Guimia, filtro.Tracking); } if (!string.IsNullOrEmpty(filtro.SenderName)) { sqlcommand.Parameters.AddWithValue(Parametros.Nombre, filtro.SenderName); } if (!string.IsNullOrEmpty(filtro.SenderPhone)) { sqlcommand.Parameters.AddWithValue(Parametros.Telefono, filtro.SenderPhone); } if (filtro.InitialDate.HasValue) { sqlcommand.Parameters.AddWithValue(Parametros.Fecha, filtro.InitialDate.Value); } if (filtro.FinalDate.HasValue) { sqlcommand.Parameters.AddWithValue(Parametros.FechaFinal, filtro.FinalDate.Value); } sqlcommand.Parameters.AddWithValue(Parametros.Operation, 13); List <Waybill> manifiestos = new List <Waybill>(); Waybill manifiesto = null; using (SqlDataReader reader = sqlcommand.ExecuteReader()) { while (reader.Read()) { manifiesto = new Waybill(); manifiesto.Id = (int)reader["manifiesto_id"]; manifiesto.WaybillNumber = (string)reader["nrogui"]; manifiesto.ReceiptDate = (DateTime)reader["fec_recibo"]; manifiesto.WeightLB = (decimal)reader["pesolb"]; manifiesto.Pieces = (int)reader["nropaq"]; manifiesto.SenderName = (string)reader["rem_nombre"]; manifiesto.SenderPhone = (string)reader["rem_telefono"]; manifiesto.Total = reader.IsDBNull(reader.GetOrdinal("total")) ? 0 : (decimal)reader["total"]; manifiestos.Add(manifiesto); } } DisposeCommand(sqlcommand); return(manifiestos); }
public async Task CreateAsync(WaybillSaveModel waybillModel) { var waybill = new Waybill(); waybillModel.ApplyToEntity(waybill, _dataStore); await _dataStore.SaveAsync(waybill); }
public void Create(WaybillSaveModel waybillModel) { var waybill = new Waybill(); waybillModel.ApplyToEntity(waybill, _dataStore); _dataStore.Save(waybill); }
public ActionResult DeleteConfirmed(int id) { Waybill waybill = db.Waybills.Find(id); db.Waybills.Remove(waybill); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Add(Store store, Waybill waybill, Storekeeper storekeeper) { var sql = "Insert into AcceptedWaybills (Id, StoreId, WaybillId, StorekeeperId) Values (@Id, @StoreId, @WaybillId, @StorekeeperId);"; using (var connection = new SqlConnection(connectionString)) { connection.Execute(sql, new { Id = Guid.NewGuid(), StoreId = store.Id, WaybillId = waybill.Id, StorekeeperId = storekeeper.Id }); } }
public void CreateDelivare(WaybillBM model) { using (var transaction = context.Database.BeginTransaction()) { try { Waybill element = new Waybill { Date = model.Date, StockId = model.StockId, TypeOfWaybillId = Convert.ToInt32(3 + ""), Summa = model.Summa, ShopHallId = model.ShopHallId }; context.Waybills.Add(element); context.SaveChanges(); CountOst(model); // убираем дубли по компонентам /* var groupProducts = model.ProductWaybills * .GroupBy(rec => rec.ProductId) * .Select(rec => new * { * ProductId = rec.Key, * Count = rec.Sum(r => r.Count) * }); * // добавляем компоненты * foreach (var groupProduct in groupProducts) * { * context.ProductWaybills.Add(new ProductWaybill * { * WaybillId = element.Id, * ProductId = groupProduct.ProductId, * Count = groupProduct.Count * }); * context.SaveChanges(); * }*/ foreach (var ProductWaybill in model.ProductWaybills) { context.ProductWaybills.Add(new ProductWaybill { WaybillId = element.Id, ProductId = ProductWaybill.ProductId, Count = ProductWaybill.Count }); context.SaveChanges(); } transaction.Commit(); } catch (Exception) { transaction.Rollback(); throw; } } }
public WaybillActDocumentSettings Setup(Waybill waybill) { DocId = waybill.Id.ToString(); DocumentDate = waybill.DocumentDate; Person1Position = "Фармацевт"; Person2Position = "Зав. аптекой"; Person3Position = "Директор"; Person3Name = waybill.WaybillSettings.Director; return(this); }
public ActionResult WaybillDetails(int id) { Waybill waybill = waybillContext.Waybill.Find(id); if (waybill != null) { return(View(waybill)); } return(View("Index")); }
public ActionResult DeleteWaybill(int id) { Waybill waybill = waybillContext.Waybill.Find(id); if (waybill != null) { return(PartialView("DeleteWaybill", waybill)); } return(View("WaybillList")); }
public void SetByWaybill(Waybill waybill) { var stocks = context.Stocks.GetAll().ToList(); var waybillDetails = context.WaibillDetails.GetAll().Where(x => x.WaibillId == waybill.Id).ToList(); foreach (var waybillDetail in waybillDetails) { UpdateProductCount(stocks, waybillDetail); } }
public ActionResult WaybillEdit(Waybill waybill) { waybillContext.Entry(waybill).State = EntityState.Modified; waybill.Bus = waybillContext.Bus.Where(n => n.number_bus == waybill.Bus.number_bus).FirstOrDefault(); waybill.BusId = waybill.Bus.Id; waybill.User = userContext.User.Where(u => u.LastName == waybill.User.LastName).Where(g => g.RoleID == 4).FirstOrDefault(); waybill.UserId = waybill.User.Id; waybillContext.SaveChanges(); return(RedirectToAction("WaybillList")); }
public CreateWaybill(Waybill waybill) { InitFields(); Waybill = waybill; DisplayName = "Создание накладной"; if (UseSupplierList) { RxQuery(x => x.Query <Supplier>().OrderBy(s => s.Name).ToArray()).Subscribe(Suppliers); } WasCancelled = true; }
public ActionResult DeleteWaybill(int id, FormCollection collection) { Waybill waybill = waybillContext.Waybill.Find(id); if (waybill != null) { waybillContext.Waybill.Remove(waybill); waybillContext.SaveChanges(); } return(RedirectToAction("WaybillList")); }