internal bool addReturnItem() { bool b = false; try { if (isValidForm()) { CompanyReturn companyReturn = new CompanyReturn(); companyReturn.BuyingInvoiceId = addCompanyReturn.BuyingInvoiceId; companyReturn.ItemId = addCompanyReturn.SelectedItem.Id; companyReturn.Date = addCompanyReturn.datePicker_date.SelectedValue; companyReturn.Price = addCompanyReturn.textBox_price.DoubleValue; companyReturn.Quantity = addCompanyReturn.textBox_quantity.DoubleValue; CommonMethods.setCDMDForAdd(companyReturn); if (add(companyReturn) > 0) { StockItem stockItem = stockManagerImpl.getStockItemByStockLocationIdAndItemId(Convert.ToInt32(Session.Preference["defaultCompanyReturnStock"]), addCompanyReturn.SelectedItem.Id); stockItem.Quantity -= addCompanyReturn.textBox_quantity.DoubleValue; CommonMethods.setCDMDForUpdate(stockItem); stockManagerImpl.updStockItem(stockItem); b = true; loadAllReturnedItems(); resetAddForm(); } } } catch (Exception) { } return(b); }
internal void loadAvailableQuantitiesForMode() { try { StockItem stockItemFrom = stockManagerImpl.getStockItemByStockLocationIdAndItemId(Convert.ToInt32(addStockTransfer.comboBox_from_selectStock.SelectedValue), addStockTransfer.SelectedItem.Id); StockItem stockItemTo = stockManagerImpl.getStockItemByStockLocationIdAndItemId(Convert.ToInt32(addStockTransfer.comboBox_to_selectStock.SelectedValue), addStockTransfer.SelectedItem.Id); if (addStockTransfer.radioButton_pack.IsChecked == true) { addStockTransfer.label_availableQuantity_from.Content = (stockItemFrom.Quantity / addStockTransfer.SelectedItem.QuantityPerPack).ToString("#,##0.00"); addStockTransfer.label_availableQuantity_to.Content = (stockItemTo.Quantity / addStockTransfer.SelectedItem.QuantityPerPack).ToString("#,##0.00"); } else { addStockTransfer.label_availableQuantity_from.Content = stockItemFrom.Quantity.ToString("#,##0.00"); addStockTransfer.label_availableQuantity_to.Content = stockItemTo.Quantity.ToString("#,##0.00"); } addStockTransfer.textBox_quantity.Focus(); } catch (Exception) { } }