private bool CheckStock() { ProductInfo producto = ProductInfo.Get(_entity.OidProducto); if (producto.AvisarStock) { BatchInfo partida = BatchInfo.Get(_entity.OidPartida, false); if (!partida.CheckStock(_entity, producto)) { DialogResult result = PgMng.ShowWarningException(Resources.Messages.AVISO_STOCK_MINIMO); if (result == DialogResult.Yes) { return(true); } else { return(false); } } else { return(true); } } else { return(true); } }
protected override void SelectProductoAction() { ProductList lista; lista = ProductList.GetListBySerie(_serie.Oid, false, true); ProductSelectForm form = new ProductSelectForm(this, lista); if (form.ShowDialog(this) == DialogResult.OK) { _producto = ProductInfo.Get((form.Selected as ProductInfo).Oid, false, true); _entity.CopyFrom(_producto); AsignaPrecio(); Datos_Productos.DataSource = _producto; EnableKilos(); if (_entity.FacturacionBulto) { Pieces_NTB.Focus(); } else { Kilos_NTB.Focus(); } } }
protected override void SelectPartidaAction() { BatchList lista; lista = BatchList.GetListBySerieAndStock(_serie.Oid, true, false, true); BatchSelectForm form = new BatchSelectForm(this, _serie, lista); if (form.ShowDialog(this) == DialogResult.OK) { _partida = form.Selected as BatchInfo; _producto = ProductInfo.Get(_partida.OidProducto, false, true); _entity.CopyFrom(_partida, _producto); AsignaPrecio(); Datos_Partida.DataSource = _partida; EnableKilos(); if (_entity.FacturacionBulto) { Pieces_NTB.Focus(); } else { Kilos_NTB.Focus(); } } }
public ActionResult OldOrder(Warranty record) { if (String.IsNullOrEmpty(record.OrderCode)) { record.Messages = new List <string>() { "Chưa có mã hóa đơn" } } ; var model = new WarrantyModel(); model.SelectedProduct = ProductInfo.Get(UserID, Employee.ID, record.ProductID, false, DbAction.Warranty.Create); model.Record = record; var login = Login.Get(UserID); model.Editable = login.Type == LoginType.Office || login.Username == "admin"; if (Request.IsAjaxRequest()) { return(Json(new { html = RenderPartialViewToString("SelectedProduct", model) }, JsonRequestBehavior.DenyGet)); } return(View(Views.Save, model)); }
protected override void RefreshMainData() { if (_entity == null) { return; } Datos.DataSource = _entity; _product = ProductInfo.Get(_entity.OidProducto, false); PgMng.Grow(); switch (_product_type) { case ETipoProducto.Almacen: { BatchList lista; if (_delivery.Rectificativo) { lista = BatchList.GetListBySerie(_serie.Oid, false, true); } else { lista = BatchList.GetListBySerieAndStock(_serie.Oid, false, true); } _batch = lista.GetItem(_entity.OidPartida); //Caso extraño de que se vaya a modificar un concepto de un producto con stock 0 if (_batch == null) { _batch = BatchInfo.Get(_entity.OidPartida, false); } Batch_BS.DataSource = _batch; _batch.StockBultos += _entity.CantidadBultos; _batch.StockKilos += _entity.CantidadKilos; PgMng.Grow(); } break; case ETipoProducto.Libres: { _batch = null; Products_BS.DataSource = _product; PgMng.Grow(); } break; } base.RefreshMainData(); EnableKilos(); }
protected override void GetFormSourceData(long oid) { _entity = ProductInfo.Get(oid, true); if (_entity.IsKit) { _entity.LoadChilds(typeof(Kit), false); } }
protected override void UpdateDeliveryAction() { InputDeliveryLine item = Lines_BS.Current as InputDeliveryLine; ProductInfo producto = ProductInfo.Get(item.OidProducto, false, true); _entity.CalculateTotal(); ControlsMng.UpdateBinding(Lines_BS); }
protected override void UpdateFacturaAction() { InputInvoiceLine item = Datos_Lineas.Current as InputInvoiceLine; ProductInfo product = ProductInfo.Get(item.OidProducto, false, true); item.BalanceQuantity(_entity, product); _entity.CalculateTotal(); ControlsMng.UpdateBinding(Datos_Lineas); }
protected override void UpdatePedidoAction() { LineaPedido item = Datos_Lineas.Current as LineaPedido; ProductInfo producto = ProductInfo.Get(item.OidProducto, false, true); item.AjustaCantidad(producto); _entity.CalculateTotal(); ControlsMng.UpdateBinding(Datos_Lineas); }
protected override void UpdatePedidoAction() { LineaPedidoProveedor item = Datos_Lineas.Current as LineaPedidoProveedor; ProductInfo producto = ProductInfo.Get(item.OidProducto, false, true); item.AjustaCantidad(producto); _entity.CalculaTotal(); RefreshLineas(); }
protected override void SelectProductAction() { ProductList list = ProductList.GetListBySerie(_serie.Oid, false, true); ProductSelectForm form = new ProductSelectForm(this, list); if (form.ShowDialog(this) == DialogResult.OK) { if ((form.Selected as ProductInfo).IsKit) { PgMng.ShowInfoException(Library.Store.Resources.Messages.KIT_ENTRY_NOT_ALLOWED); return; } _product = ProductInfo.Get((form.Selected as ProductInfo).Oid, false); Products_BS.DataSource = _product; _entity.CopyFrom(_delivery, _product); if (_product.NoStockSale) { SetStockControl(false); SetStore(null); } else { if (_delivery.Rectificativo) { SelectBatchAction(); SetStockControl(false); } else { SetStockControl(true); SetStore(_delivery_store); SetExpedient(_delivery_expedient); } } Kilos_NTB.Text = _entity.CantidadKilos.ToString("N2"); Pieces_NTB.Text = _entity.CantidadBultos.ToString("N2"); SetPrice(); if (_entity.FacturacionBulto) { Pieces_NTB.Focus(); } else { Kilos_NTB.Focus(); } SaleMethod_BT.Enabled = (_product.ETipoFacturacion != ETipoFacturacion.Unitaria); } }
public ActionResult Submit(Repair record) { var result = false; var list = new RepairList(); var model = new RepairModel(); var action = record.ID > 0 ? DbAction.Repair.Modify : DbAction.Repair.Create; var message = ""; if (!record.ProductID.HasValue && String.IsNullOrEmpty(record.ProductName)) { message = "Thiếu thông tin sản phẩm"; } else if (record.WarehouseID == 0) { message = "Chưa chọn kho"; } else { var warehouses = WarehouseInfo.FindAuthorized(UserID, Employee.ID, Employee.BussinessID, UserID, action); record.ReceiveWarehouseID = warehouses.FirstOrDefault().ID; model.Record = record.Save(ModelState, UserID, Employee.ID, Employee.BussinessID, Employee.Name); if (result = model.Record != null) { message = "Lưu thông tin thành công"; } } if (result) { if (record.ProductID.HasValue) { model.SelectedProduct = ProductInfo.Get(UserID, Employee.ID, record.ProductID.Value, false, action); } var login = Login.Get(UserID); model.ViewInternalNote = login.Type == LoginType.Mechanic || login.Type == LoginType.Office || login.Username == "admin"; } else { model.Record = record; } model.Record.Messages = new List <string>() { message }; list.Current = model; if (Request.IsAjaxRequest()) { return(Json(new { result = result, message = message, html = result ? RenderPartialViewToString(Views.HistoryPartial, list) : null }, JsonRequestBehavior.DenyGet)); } return(RedirectToAction("History")); }
protected override void UpdateDeliveryAction() { OutputDeliveryLine item = Lines_BS.Current as OutputDeliveryLine; ProductInfo producto = ProductInfo.Get(item.OidProducto, false, false); BatchInfo partida = BatchInfo.Get(item.OidPartida, false, false); item.AjustaCantidad(producto, (partida.Oid == 0) ? null : partida); _entity.CalculateTotal(); ControlsMng.UpdateBinding(Lines_BS); }
public ActionResult OldOrder(int id) { var model = new WarrantyModel(); model.SelectedProduct = ProductInfo.Get(UserID, Employee.ID, id, false, DbAction.Warranty.Create); if (Request.IsAjaxRequest()) { return(Json(new { html = RenderPartialViewToString("OldOrder", model) }, JsonRequestBehavior.AllowGet)); } return(View(Views.Save, model)); }
protected override void RefreshMainData() { if (_entity == null) { return; } Datos.DataSource = _entity; _producto = ProductInfo.Get(_entity.OidProducto, false); PgMng.Grow(); switch (_tipo) { case ETipoProducto.Almacen: { BatchList lista; lista = BatchList.GetListBySerieAndStock(_serie.Oid, false, true); _partida = lista.GetItem(_entity.OidPartida); //Caso extraño de que se vaya a modificar un concepto de un producto con stock 0 if (_partida == null) { _partida = BatchInfo.Get(_entity.OidPartida, false); } Datos_Partida.DataSource = _partida; _partida.StockBultos += _entity.CantidadBultos; _partida.StockKilos += _entity.CantidadKilos; PgMng.Grow(); } break; case ETipoProducto.Libres: { _partida = null; Datos_Productos.DataSource = _producto; PgMng.Grow(); } break; } base.RefreshMainData(); EnableKilos(); }
protected override void UpdateInvoiceAction() { try { OutputInvoiceLine item = Lines_DGW.CurrentRow.DataBoundItem as OutputInvoiceLine; BatchInfo batch = BatchInfo.Get(item.OidPartida, false, true); ProductInfo producto = ProductInfo.Get(item.OidProducto, false, false); item.AjustaCantidad(producto, batch); _entity.CalculateTotal(); ControlsMng.UpdateBinding(Lines_BS); } catch { } }
protected override void RefreshMainData() { if (_entity == null) { return; } Datos.DataSource = _entity; _product = ProductInfo.Get(_entity.OidProducto, true); Products_BS.DataSource = _product; PgMng.Grow(); base.RefreshMainData(); }
public Decimal GetPrecio(ProductInfo producto, BatchInfo partida, ETipoFacturacion tipo) { if (Productos == null) { LoadChilds(typeof(ProductoCliente), false); } long oid_producto = (producto != null) ? producto.Oid : partida.OidProducto; producto = (producto != null) ? producto : ProductInfo.Get(oid_producto, false, true); ProductoClienteInfo producto_cliente = Productos.GetByProducto(oid_producto); Decimal precio = producto.GetPrecioVenta(producto_cliente, partida, tipo); return(precio); }
protected override void SelectPartidaAction() { BatchList lista; if (_delivery.Rectificativo) { lista = BatchList.GetListBySerie(_serie.Oid, false, true); } else { lista = BatchList.GetListBySerieAndStock(_serie.Oid, true, false, true); } BatchSelectForm form = new BatchSelectForm(this, _serie, lista); if (form.ShowDialog(this) == DialogResult.OK) { _batch = form.Selected as BatchInfo; _product = ProductInfo.Get(_batch.OidProducto, false, true); _entity.CopyFrom(_delivery, _batch, _product); _entity.SetTaxes(_client, _product, _serie); AsignaPrecio(); Batch_BS.DataSource = _batch; EnableKilos(); if (_entity.FacturacionBulto) { Pieces_NTB.Focus(); } else { Kilos_NTB.Focus(); } } ShowLineGrid(ETipoProducto.Almacen); }
public ActionResult SelectProduct(Repair record) { var model = new RepairModel(); if (record.ProductID.HasValue) { model.SelectedProduct = ProductInfo.Get(UserID, Employee.ID, record.ProductID.Value, false, DbAction.Repair.Create); } model.Record = record; var login = Login.Get(UserID); model.Editable = login.Type == LoginType.Office || login.Username == "admin"; if (Request.IsAjaxRequest()) { return(Json(new { html = RenderPartialViewToString("SelectedProduct", model) }, JsonRequestBehavior.AllowGet)); } return(View(Views.Save, model)); }
public ActionResult Submit(Warranty record) { var result = false; var list = new WarrantyList(); var model = new WarrantyModel(); var action = record.ID > 0 ? DbAction.Warranty.Modify : DbAction.Warranty.Create; var warehouses = WarehouseInfo.FindAuthorized(UserID, Employee.ID, Employee.BussinessID, UserID, action); record.ReceiveWarehouseID = warehouses.FirstOrDefault().ID; model.Record = record.Save(ModelState, UserID, Employee.ID, Employee.BussinessID, Employee.Name); if (result = model.Record != null) { model.SelectedProduct = ProductInfo.Get(UserID, Employee.ID, record.ProductID, false, action); if (model.Record.OrderID.HasValue) { model.SelectedOrder = Export.GetOrder(UserID, Employee.ID, model.Record.OrderID.Value, false, action); } var login = Login.Get(UserID); model.ViewInternalNote = login.Type == LoginType.Mechanic || login.Type == LoginType.Office || login.Username == "admin"; } else { model.Record = record; } list.Current = model; var message = result ? "Lưu thông tin không thành công" : null; if (Request.IsAjaxRequest()) { return(Json(new { result = result, message = message, html = result ? RenderPartialViewToString(Views.HistoryPartial, list) : null }, JsonRequestBehavior.DenyGet)); } return(RedirectToAction("History")); }
protected override void SelectProductoAction() { ProductList lista; lista = ProductList.GetListBySerie(_serie.Oid, false, true); ProductSelectForm form = new ProductSelectForm(this, lista); if (form.ShowDialog(this) == DialogResult.OK) { _product = ProductInfo.Get((form.Selected as ProductInfo).Oid, false, true); _entity.CopyFrom(_delivery, _product); _entity.SetTaxes(_client, _product, _serie); _entity.AjustaCantidad(_product, null, 1); SetStore(StoreInfo.Get(_delivery.OidAlmacen != 0 ? _delivery.OidAlmacen : Library.Store.ModulePrincipal.GetDefaultAlmacenSetting(), false)); AsignaPrecio(); Products_BS.DataSource = _product; EnableKilos(); if (_entity.FacturacionBulto) { Pieces_NTB.Focus(); } else { Kilos_NTB.Focus(); } } ShowLineGrid(ETipoProducto.Libres); }
public ActionResult SelectProduct(int id) { var model = new WarrantyModel(); var product = Export.GetProduct(UserID, Employee.ID, id); model.SelectedProduct = ProductInfo.Get(UserID, Employee.ID, product.ProductID, false, DbAction.Warranty.Create); if (product != null) { model.Record.ProductID = product.ProductID; model.SelectedOrder = Export.GetOrder(UserID, Employee.ID, product.OrderID.Value, false, DbAction.Warranty.Create); if (model.SelectedOrder != null) { model.Record.WarehouseID = model.SelectedOrder.WarehouseID; model.Record.WarehouseName = model.SelectedOrder.WarehouseName; model.Record.EmployeeName = Employee.Name; model.Record.ClientID = model.SelectedOrder.ClientID; model.Record.ClientName = model.SelectedOrder.ClientName; model.Record.ClientCode = model.SelectedOrder.ClientCode; model.Record.ClientPhone = model.SelectedOrder.ClientPhone; model.Record.ClientAddress = model.SelectedOrder.ClientAddress; model.Record.OrderID = model.SelectedOrder.ID; model.Record.OrderCode = model.SelectedOrder.Code; } } var login = Login.Get(UserID); model.Editable = login.Type == LoginType.Office || login.Username == "admin"; if (Request.IsAjaxRequest()) { return(Json(new { html = RenderPartialViewToString("SelectedProduct", model) }, JsonRequestBehavior.AllowGet)); } return(View(Views.Save, model)); }
public override void RefreshSecondaryData() { PrecioProducto_NTB.Text = ProductInfo.Get(_entity.OidProducto).PrecioCompra.ToString("N5"); PgMng.Grow(); }
protected override void GetFormSourceData(long oid) { _entity = ProductInfo.Get(oid, true); }