Ejemplo n.º 1
0
        private void filetr_detail()
        {
            app_location   app_location   = app_branchapp_locationViewSource.View.CurrentItem as app_location;
            item_inventory item_inventory = item_inventoryViewSource.View.CurrentItem as item_inventory;

            if (app_location != null)
            {
                if (item_inventoryitem_inventory_detailViewSource != null)
                {
                    if (item_inventoryitem_inventory_detailViewSource.View != null)
                    {
                        item_inventoryitem_inventory_detailViewSource.View.Filter = i =>
                        {
                            item_inventory_detail item_inventory_detail = (item_inventory_detail)i;
                            if (item_inventory_detail.id_location == app_location.id_location && item_inventory_detail.id_inventory == item_inventory.id_inventory)
                            {
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        };
                    }
                }
            }

            TextBox_TextChanged(null, null);
        }
Ejemplo n.º 2
0
        private void crud_modal_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (crud_modal.IsVisible == false)
            {
                item_inventory item_inventory = (item_inventory)item_inventoryViewSource.View.CurrentItem;

                item_inventoryViewSource.View.Refresh();
                item_inventoryitem_inventory_detailViewSource.View.Refresh();
                item_inventoryitem_inventory_detailViewSource.View.MoveCurrentToFirst();
            }
        }
Ejemplo n.º 3
0
        private void toolBar_btnApprove_Click(object sender)
        {
            item_inventory item_inventory = (item_inventory)item_inventoryDataGrid.SelectedItem;

            item_inventory.id_branch = (int)cbxBranch.SelectedValue;

            if (InventoryDB.Approve())
            {
                toolBar.msgApproved(InventoryDB.NumberOfRecords);
            }
        }
Ejemplo n.º 4
0
        private void BindItemMovement()
        {
            item_inventory item_inventory = null;
            app_location   app_location   = null;

            item_inventory = (item_inventory)item_inventoryViewSource.View.CurrentItem;
            app_location   = app_branchapp_locationViewSource.View.CurrentItem as app_location;

            if (app_location != null && item_inventory != null)
            {
                if (item_inventory.item_inventory_detail.Where(x => x.id_location == app_location.id_location).Count() == 0)
                {
                    if (app_location != null)
                    {
                        List <item_product>     item_productLIST = InventoryDB.item_product.Where(x => x.id_company == CurrentSession.Id_Company && x.item.is_active).ToList();
                        Class.StockCalculations Stock            = new Class.StockCalculations();
                        List <Class.StockList>  StockList        = Stock.ByBranchLocation(app_location.id_location, DateTime.Now);

                        foreach (item_product i in item_productLIST)
                        {
                            item_inventory_detail item_inventory_detail = new item_inventory_detail();
                            item_inventory_detail.State           = EntityState.Added;
                            item_inventory_detail.item_product    = i;
                            item_inventory_detail.id_item_product = i.id_item_product;

                            item_inventory_detail.app_location = app_location;
                            item_inventory_detail.id_location  = app_location.id_location;
                            item_inventory_detail.timestamp    = DateTime.Now;

                            if (StockList.Where(x => x.ProductID == i.id_item_product).FirstOrDefault() != null)
                            {
                                item_inventory_detail.value_system = StockList.Where(x => x.ProductID == i.id_item_product).FirstOrDefault().Quantity;
                                item_inventory_detail.unit_value   = StockList.Where(x => x.ProductID == i.id_item_product).FirstOrDefault().Cost;
                            }
                            else
                            {
                                item_inventory_detail.value_system = 0;
                            }

                            if (CurrencyID > 0)
                            {
                                item_inventory_detail.id_currencyfx = CurrencyID;
                            }

                            item_inventory.item_inventory_detail.Add(item_inventory_detail);
                        }
                    }
                }

                item_inventoryitem_inventory_detailViewSource.View.Refresh();
                filetr_detail();
            }
        }
Ejemplo n.º 5
0
 private void toolBar_btnEdit_Click(object sender)
 {
     if (item_inventoryDataGrid.SelectedItem != null)
     {
         item_inventory item_inventory_old = (item_inventory)item_inventoryDataGrid.SelectedItem;
         item_inventory_old.IsSelected = true;
         item_inventory_old.State      = EntityState.Modified;
         InventoryDB.Entry(item_inventory_old).State = EntityState.Modified;
     }
     else
     {
         toolBar.msgWarning("Please Select an Item");
     }
 }
Ejemplo n.º 6
0
 private void toolBar_btnNew_Click(object sender)
 {
     try
     {
         app_branch     app_branch     = app_branchViewSource.View.CurrentItem as app_branch;
         item_inventory item_inventory = new item_inventory();
         item_inventory.IsSelected = true;
         item_inventory.id_branch  = app_branch.id_branch;
         item_inventory.trans_date = DateTime.Now;
         InventoryDB.Entry(item_inventory).State = EntityState.Added;
         item_inventory.State = EntityState.Added;
         app_branchViewSource.View.MoveCurrentToFirst();
         app_branchapp_locationViewSource.View.MoveCurrentToFirst();
         item_inventoryViewSource.View.Refresh();
         item_inventoryViewSource.View.MoveCurrentToLast();
     }
     catch (Exception ex)
     {
         toolBar.msgError(ex);
     }
 }
Ejemplo n.º 7
0
        private void EditCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            crud_modal.Children.Clear();
            crud_modal.Visibility = Visibility.Hidden;
            item_inventory_detail item_inventory_detail = e.Parameter as item_inventory_detail;
            item_inventory        item_inventory        = (item_inventory)item_inventoryDataGrid.SelectedItem;

            if (item_inventory_detail != null)
            {
                crud_modal.Visibility = System.Windows.Visibility.Visible;
                objpnl_ItemMovement   = new cntrl.Panels.pnl_ItemMovement();

                foreach (item_inventory_detail _item_inventory_detail in item_inventoryitem_inventory_detailViewSource.View.OfType <item_inventory_detail>().Where(x => x.id_item_product == item_inventory_detail.id_item_product).ToList())
                {
                    if (_item_inventory_detail.item_inventory_dimension.Count() == 0)
                    {
                        if (InventoryDB.item_dimension.Where(x => x.id_item == _item_inventory_detail.item_product.id_item).ToList() != null)
                        {
                            List <item_dimension> item_dimensionList = InventoryDB.item_dimension.Where(x => x.id_item == _item_inventory_detail.item_product.id_item).ToList();
                            foreach (item_dimension item_dimension in item_dimensionList)
                            {
                                item_inventory_dimension item_inventory_dimension = new item_inventory_dimension();
                                item_inventory_dimension.id_dimension = item_dimension.id_app_dimension;
                                item_inventory_dimension.value        = item_dimension.value;
                                //  item_inventory_dimension.id_measurement = item_dimension.id_measurement;
                                item_inventory_detail.item_inventory_dimension.Add(item_inventory_dimension);
                            }
                        }
                    }
                    _item_inventory_detail.IsSelected = true;
                }

                objpnl_ItemMovement.item_inventoryList = item_inventoryitem_inventory_detailViewSource.View.OfType <item_inventory_detail>().Where(x => x.id_item_product == item_inventory_detail.id_item_product).ToList();
                objpnl_ItemMovement.InventoryDB        = InventoryDB;
                crud_modal.Children.Add(objpnl_ItemMovement);
            }
        }